Question

I have this simple piece of code and I am wondering how to convert it to German format (#.###,##) ?

// displays #.##
<Label Content="{Binding MySumValue}"/>
Was it helpful?

Solution

Try set the ContentStringFormat for Label or just StringFormat for TextBlock with necessary xml:lang.

Example:

<Grid>
    <Button Name="MyButton" 
            Content="OK" 
            Width="100,999" 
            Height="25" />

    <Label Name="MyLabel"                
           Content="{Binding Path=Width, ElementName=MyButton}"
           xml:lang="de-DE"
           ContentStringFormat="{}{0:N2}" /> 
</Grid>

Output

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top