I want to format my slider value to be 00:00 format. The below code worked for me, but what I wanted is 00:00 format. I am looking for a total XAML solution. I know that I can write a converter for this easily but wonder if there are any StringFormat way to make it.
Text="{Binding Value, ElementName=slider,StringFormat=\{0:00.00\}}"
My question here is how can I get colon ':' instead of dot '.' ?
If you just want to put a :
symbol in the format string, then you escape it with backslashes:
Text="{Binding Value, ElementName=slider,StringFormat=\{0:00\\:00\}}"
But I think this is what you want to do:
<Slider Name="slider" Width="500" Height="30" Maximum="100" Minimum="0" />
<TextBlock Text="{Binding Path=Value, ElementName=slider, StringFormat={}{0:00\\:00}}" />
You can use the default String formatting options in the StringFormat as in regular C# code. Have a look at this page, you'll probably find what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With