Articles in this section
Category / Section

How to restrict the decimal values in WPF PercentTextBox?

1 min read

You can restrict the number of decimal places by using the PercentDecimalDigits property in WPF PercentTextBox.

XAML

<Grid>
     <syncfusion:PercentTextBox Name="PercentTextBox"  PercentDecimalDigits="0" />
</Grid>

C#

// The following code shows how to set the PercentDecimalDigits property for the PercentTextBox.
using Syncfusion.Windows.Tools.Controls;
using Syncfusion.Windows.Shared;
namespace WpfApplication24
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            PercentTextBox.PercentDecimalDigits = 0;
        }     
    }
}

The following output shows that decimal digits are not applied for the PercentTextBox.

Restrict decimal values in WPF PercentTextBox

 

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