Articles in this section

What is the purpose of ValueChangeMode in WinRT NumericTextBox?

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.

XAML:

<Page
x:Class="Windows_new.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Windows_new"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:editors="using:Syncfusion.UI.Xaml.Controls.Input"
mc:Ignorable="d">
<Grid Background="Black">
<editors:SfNumericTextBox x:Name="Numeric1" Width="200" Height="23" ValueChangedMode="OnKeyFocus"/>
</Grid>
</Page>

 

C#:

using Syncfusion.UI.Xaml.Controls.Input;
// he Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace Windows_new
{
/// <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();
 
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.

XAML:

<Page

x:Class="Windows_new.MainPage"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:local="using:Windows_new"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns:editors="using:Syncfusion.UI.Xaml.Controls.Input"

mc:Ignorable="d">

<Grid x:Name="Grid1" Background="Black">

<editors:SfNumericTextBox x:Name="NumericTextBox1" Width="200" Height="23" ValueChangedMode="OnLostFocus"/>

</Grid>

</Page>


 

C#:

using Syncfusion.UI.Xaml.Controls.Input;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace Windows_new

{

/// <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();

 

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)
Access denied
Access denied