Articles in this section
Category / Section

What is the purpose of ValueChangeMode in SfNumericTextBox?

1 min read

The ValueChangeMode property is used to update the value property when a key is pressed or focus is lost. It contains two options described below:

  1. OnLostFocus
  2. OnKeyFocus

 OnKeyFocus: When the ValueChangeMode is OnKeyFocus, the value will be changed for each keypress. The following code demonstrates how to set the ValueChangeMode as OnKeyFocus.

Code Snippet

XAML Code

<Grid x:Name="Grid1" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
   <syncfusion:SfNumericTextBox x:Name="Numeric1" Width="200" Height="23" 
                                ValueChangedMode="OnKeyFocus"/>
</Grid>

C# Code

 
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            SfNumericTextBox NumericTextBox1 = new SfNumericTextBox();
            NumericTextBox1.Width = 200;
            NumericTextBox1.Height = 23;
            NumericTextBox1.ValueChangedMode = ValueChange.OnKeyFocus;
            Grid1.Children.Add(NumericTextBox1);
        }
    }
 

 

OnLostFocus: The value in the SfNumericTextBox change will be updated when the control is no longer focused. The following code demonstrate how to set the ValueChangedMode property as OnLostFocus.

Code Snippet

XAML Code

<Grid x:Name="Grid1" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
   <syncfusion:SfNumericTextBox x:Name="Numeric1" Width="200" Height="23"
                     Value="123.56" ValueChangedMode="OnLostFocus"/>
</Grid>

 

C# Code

    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            SfNumericTextBox NumericTextBox1 = new SfNumericTextBox();
            NumericTextBox1.Width = 200;
            NumericTextBox1.Height = 23;
            NumericTextBox1.ValueChangedMode = ValueChange.OnLostFocus;
            Grid1.Children.Add(NumericTextBox1);
        }
    }
 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied