How to apply color for zero value in WPF PercentTextBox?
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.
Conclusion
I hope you enjoyed learning about how to apply color for Zero value in WPF Percent Textbox.
You can refer to our WPF Percent Textbox feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Percent Textbox documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!