Skip to content

Commit 1eb0bb5

Browse files

File tree

1 file changed

+36
-50
lines changed

1 file changed

+36
-50
lines changed

README.md

Lines changed: 36 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,52 @@
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
22

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.
44

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).
66

7-
![Output image of NumericTextBox with ClearButton](Outputs/NumericTextBoxWithClearButton.png)
7+
## Syncfusion controls:
88

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)
1011

11-
![Output image of NumericTextBox without ClearButton](Outputs/NumericTextBoxWithoutClearButton.png)
12-
13-
## Creating the above UI
12+
## Supported platforms
1413

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 |
1619

17-
[C#]
20+
## Requirements to run the sample
1821

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/)
2223

23-
}
24-
```
24+
Refer to the following link for more details - [System Requirements](https://help.syncfusion.com/xamarin/system-requirements)
2525

26-
[XAML]
26+
## How to run the sample
2727

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.
6229

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.
6333

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.
6447

48+
4. Run the application.
6549

50+
## License
6651

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

Comments
 (0)