To format a text that is to be displayed in a textblock, first bind the textblock with the field and then use StringFormat attribute of the textblock to format the value.
For example:
<TextBlock Text="{Binding Children.Count}"/>
If you want to insert braces surrounding this value:
<TextBlock Text="{Binding Children.Count, StringFormat='{}{0:(#)}'}"/>
No comments:
Post a Comment