I have a details view window in WPF and a label may look like this.
<Label Content="{x:Static properties:Resources.Reference}" />
So that is obtains it content from my property Resource.
How can transform/format the content so it has a colon after each label item. e.g. instead of the content simply displaying Reference I want it to transform to Reference:
The solution I ended up with was:
<Label Content="{x:Static properties:Resources.Reference}" ContentStringFormat="{}{0}:"/>
You can use a Binding
with StringFormat
to format the result.
<Label Content="{Binding Source={x:Static properties:Resource.Reference}, StringFormat='{}{0}:'}"
Note that the {}
before the format string is here to prevent the XAML parser from treating {0}
as a markup extension, like {StaticResource}
for example.
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