Category / Section
How to set the Maximum and Minimum value in WinRT NumericUpDown control?
1 min read
To restrict the user to change the value beyond certain range, the Maximum and Minimum property of SfNumericUpDown can be used. Beyond these two properties value, the user could not able to enter the values. The same has been demonstrated in the following code example:
XAML:
<Page x:Class="App4.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App4" xmlns:navigation="using:Syncfusion.UI.Xaml.Controls.Navigation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:syncfusion="using:Syncfusion.UI.Xaml.Controls.Input" xmlns:Media="using:Syncfusion.UI.Xaml.Controls.Media" xmlns:converters="using:Syncfusion.UI.Xaml.Converters" mc:Ignorable="d"> <Page.Resources> <converters:ColorToBrushConverter x:Key="brushconverter1"/> </Page.Resources> <Grid x:Name="Grid1" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <syncfusion:SfNumericUpDown x:Name="_Updown1" Width="100" Height="23" Maximum="100" Minimum="50"/> </Grid> </Page>
C#:
using Windows.UI.Xaml.Input; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace App4 { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); SfNumericUpDown _Updown1 = new SfNumericUpDown(); _Updown1.Width = 100; _Updown1.Height = 23; _Updown1.Maximum = 100; _Updown1.Minimum = 50; Grid1.Children.Add(_Updown1); } } }