Frage

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

// displays #.##
<Label Content="{Binding MySumValue}"/>
War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top