|
1 | | -# How-to-create-a-borderless-Xamarin.Forms-numeric-control-SfNumericTextBox- |
| 1 | +# How to create a borderless Xamarin.Forms numeric control SfNumericTextBox |
2 | 2 |
|
3 | | -This article explains How to create a borderless Xamarin.Forms numeric control (SfNumericTextBox) |
| 3 | +This repository contains sample to create a borderless [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. |
| 5 | +Please refer the KB through this [link](https://www.syncfusion.com/kb/11980/how-to-create-a-borderless-xamarin-forms-numeric-control-sfnumerictextbox). |
6 | 6 |
|
7 | | -If you want to get Borderless_NumeircTextBox, you can disable the border using custom renderer and the output will be like this |
| 7 | +## Syncfusion controls: |
8 | 8 |
|
9 | | -  |
10 | | - |
11 | | -## Creating the above UI |
| 9 | +This project used the following Syncfusion control(s): |
| 10 | +* [SfNumericTextBox](https://www.syncfusion.com/xamarin-ui-controls/xamarin-numeric-entry) |
12 | 11 |
|
13 | | -You can achieve the above UI using the below code snippet |
| 12 | +## Supported platforms |
14 | 13 |
|
15 | | -[C#] |
| 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 | | -``` |
18 | | -public class CustomNumericTextBox: SfNumericTextBox |
19 | | -{ |
| 20 | +## Requirements to run the sample |
20 | 21 |
|
21 | | -} |
22 | | -``` |
| 22 | +* [Visual Studio](https://visualstudio.microsoft.com/downloads/) or [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/) |
23 | 23 |
|
24 | | -[XAML] |
| 24 | +Refer to the following link for more details - [System Requirements](https://help.syncfusion.com/xamarin/system-requirements) |
25 | 25 |
|
26 | | -``` |
27 | | -<StackLayout> |
| 26 | +## How to run the sample |
28 | 27 |
|
29 | | -<borderless_textbox:CustomNumericTextBox Value="123" HorizontalOptions="Center" VerticalOptions="Center" /> |
| 28 | +1. Clone the sample and open it in Visual Studio. |
30 | 29 |
|
31 | | -</StackLayout> |
32 | | -``` |
| 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. |
33 | 33 |
|
34 | | -[CustomNumericTextBoxRenderer_Droid] |
| 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. |
35 | 47 |
|
36 | | -``` |
37 | | - protected override void OnElementChanged(ElementChangedEventArgs<Syncfusion.SfNumericTextBox.XForms.SfNumericTextBox> e) |
38 | | - { |
39 | | - base.OnElementChanged(e); |
40 | | -
|
41 | | - if (Control != null) |
42 | | - { |
43 | | - Control.Background = null; |
44 | | - } |
45 | | - } |
46 | | - } |
47 | | -
|
48 | | -``` |
49 | | - |
50 | | -[CustomNumericTextBoxRenderer_iOS] |
51 | | - |
52 | | -``` |
53 | | - protected override void OnElementChanged(ElementChangedEventArgs<SfNumericTextBox> e) |
54 | | - { |
55 | | - base.OnElementChanged(e); |
56 | | -
|
57 | | - if (Control != null) |
58 | | - { |
59 | | - Control.BorderStyle = UIKit.UITextBorderStyle.None; |
60 | | - Control.Layer.CornerRadius = 0f; |
61 | | - Control.Layer.BorderColor = Color.Transparent.ToCGColor(); |
62 | | - Control.Layer.BorderWidth = 0; |
63 | | - } |
64 | | - } |
65 | | -``` |
66 | | - |
67 | | -[CustomNumericTextBoxRenderer_UWP] |
68 | | - |
69 | | -``` |
70 | | - protected override void OnElementChanged(ElementChangedEventArgs<SfNumericTextBox> e) |
71 | | - { |
72 | | - base.OnElementChanged(e); |
73 | | -
|
74 | | - if (Control != null) |
75 | | - { |
76 | | - Control.BorderThickness = new Windows.UI.Xaml.Thickness(0); |
77 | | - } |
78 | | - } |
79 | | -``` |
80 | | - |
81 | | -## See also |
82 | | - |
83 | | -[How to set the text color, Background color, watermark color, border color in Xamarin Numeric Entry (SfNumericTextBox)](https://help.syncfusion.com/xamarin/numeric-entry/colors) |
84 | | - |
85 | | -[How to set the maximum number of Decimal Digits in Xamarin Numeric Entry (SfNumericTextBox)](https://help.syncfusion.com/xamarin/numeric-entry/set-maximum-number-of-decimal-digits) |
86 | | - |
87 | | -[How to set the range support in Xamarin Numeric Entry (SfNumericTextBox)](https://help.syncfusion.com/xamarin/numeric-entry/range-support) |
88 | | - |
89 | | -[How to provide selection support in Xamarin Numeric Entry (SfNumericTextBox)](https://help.syncfusion.com/xamarin/numeric-entry/set-selectallonfocus) |
90 | | - |
91 | | -[How to provide Return Type in Xamarin Numeric Entry (SfNumericTextBox)](https://help.syncfusion.com/xamarin/numeric-entry/return-type) |
| 48 | +4. Run the application. |
92 | 49 |
|
| 50 | +## License |
93 | 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