|
1 | | -# How-to-disable-the-clear-button-in-numeric-textbox-in-Xamarin.Forms-UWP |
| 1 | +# How to disable the clear button in numeric textbox in Xamarin Forms |
2 | 2 |
|
3 | | -This article explains how to disable the clear button in UWP SfNumericTextBox in Xamarin.Forms |
| 3 | +This repository contains sample for hwo to disable the clear button in the [Syncfusion Xamarin.Forms Numeric TextBox](https://help.syncfusion.com/xamarin/numeric-entry/getting-started) control. |
4 | 4 |
|
5 | | -The SfNumericTextBox control is an advanced version of the Entry control that restricts input to numeric values. Its cancel button to clear the entire value in numeric textbox area as shown |
| 5 | +Please refer the KB through this [link](https://www.syncfusion.com/kb/11874/how-to-disable-the-clear-button-in-numeric-textbox-in-xamarin-forms). |
6 | 6 |
|
7 | | -  |
| 7 | +## Syncfusion controls: |
8 | 8 |
|
9 | | -If you want to get rid of this cancel button, you can disable the cancel button using custom renderer and the output will be like this |
| 9 | +This project used the following Syncfusion control(s): |
| 10 | +* [SfNumericTextBox](https://www.syncfusion.com/xamarin-ui-controls/xamarin-numeric-entry) |
10 | 11 |
|
11 | | -  |
12 | | - |
13 | | -## Creating the above UI |
| 12 | +## Supported platforms |
14 | 13 |
|
15 | | -You can achieve the above UI using the below code snippet |
| 14 | +| Platforms | Supported versions | |
| 15 | +| --------- | ------------------ | |
| 16 | +| Android | API level 21 and later versions | |
| 17 | +| iOS | iOS 9.0 and later versions | |
| 18 | +| UWP | Windows 10 devices | |
16 | 19 |
|
17 | | -[C#] |
| 20 | +## Requirements to run the sample |
18 | 21 |
|
19 | | -``` |
20 | | -public class CustomNumericTextBox: SfNumericTextBox |
21 | | -{ |
| 22 | +* [Visual Studio](https://visualstudio.microsoft.com/downloads/) or [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/) |
22 | 23 |
|
23 | | -} |
24 | | -``` |
| 24 | +Refer to the following link for more details - [System Requirements](https://help.syncfusion.com/xamarin-ios/system-requirements) |
25 | 25 |
|
26 | | -[XAML] |
| 26 | +## How to run the sample |
27 | 27 |
|
28 | | -``` |
29 | | -<StackLayout> |
30 | | -
|
31 | | - <local:CustomNumericTextBox Value="123" /> |
32 | | -
|
33 | | -</StackLayout> |
34 | | -``` |
35 | | - |
36 | | -[CustomNumericTextBoxRenderer_UWP] |
37 | | - |
38 | | -``` |
39 | | -class CustomNumericTextBoxRenderer_UWP : SfNumericTextBoxRenderer |
40 | | - { |
41 | | - protected override void OnElementChanged(ElementChangedEventArgs<SfNumericTextBox> e) |
42 | | - { |
43 | | - base.OnElementChanged(e); |
44 | | - if (Control != null) |
45 | | - { |
46 | | - Control.ShowClearButton = false; |
47 | | - } |
48 | | -
|
49 | | - } |
50 | | -
|
51 | | - |
52 | | - } |
53 | | -``` |
54 | | - |
55 | | -## See also |
56 | | - |
57 | | -[How to customize the colors in Xamarin.Forms SfNumericTextBox](https://help.syncfusion.com/xamarin/numeric-entry/colors) |
58 | | - |
59 | | -[How to format the numeric value in Xamarin.Forms SfNumericTextBox](https://help.syncfusion.com/xamarin/numeric-entry/number-formatting) |
60 | | - |
61 | | -[Available interaction in numeric control](https://help.syncfusion.com/xamarin/numeric-entry/events-and-interactivity) |
| 28 | +1. Clone the sample and open it in Visual Studio. |
62 | 29 |
|
| 30 | + *Note: If you download the sample using the "Download ZIP" option, right-click it, select Properties, and then select Unblock.* |
| 31 | + |
| 32 | +2. Register your license key in the App.xaml.cs file as demonstrated in the following code. |
63 | 33 |
|
| 34 | + public App() |
| 35 | + { |
| 36 | + //Register Syncfusion license |
| 37 | + Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY"); |
| 38 | + |
| 39 | + InitializeComponent(); |
| 40 | + |
| 41 | + MainPage = new App1.MainPage(); |
| 42 | + } |
| 43 | + |
| 44 | + Refer to this [link](https://help.syncfusion.com/xamarin/licensing/overview) for more details. |
| 45 | + |
| 46 | +3. Clean and build the application. |
64 | 47 |
|
| 48 | +4. Run the application. |
65 | 49 |
|
| 50 | +## License |
66 | 51 |
|
| 52 | +Syncfusion has no liability for any damage or consequence that may arise by using or viewing the samples. The samples are for demonstrative purposes, and if you choose to use or access the samples, you agree to not hold Syncfusion liable, in any form, for any damage that is related to use, for accessing, or viewing the samples. By accessing, viewing, or seeing the samples, you acknowledge and agree Syncfusion’s samples will not allow you seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize, or otherwise do anything with Syncfusion’s samples. |
0 commit comments