We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply color for Zero value in WPF PercentTextBox?

Platform: WPF |
Control: PercentTextBox |
Published Date: July 10, 2015 |
Last Revised Date: July 22, 2021 |
.NET Framework: 4.5

You can change a zero color for the percent value of WPF PercentTextBox by setting the ZeroColor property and it will be applied when the ApplyZeroColor property is true and the PercentValue is zero. The default color of ZeroColor is Green.

XAML

<Grid x:Name="Grid1">   
     <syncfusion:PercentTextBox Width="300" Height="100"  x:Name="Percent1" ApplyZeroColor="True" ZeroColor="Red" BorderBrush="DarkBlue"/>
</Grid>

 

C#

//Sets ApplyZeroColor and ZeroColor property.
using Syncfusion.Windows.Shared;
namespace PercentTextBox
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml.
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            PercentTextBox Percent1 = new PercentTextBox();
            Percent1.Width = 300;
            Percent1.Height = 100;
            Percent1.ApplyZeroColor = true ;
            Percent1.BorderBrush = Brushes.DarkBlue;
            Percent1.ZeroColor = Brushes.Red;
            Grid1.Children.Add(Percent1);      
        }
    }
}

 

The following screenshot shows how the zero color is applied in the PercentTextBox.

Changing Zero Color in WPF PercentTextBox

 

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile