I want to just show what is set as decimal separator, so either "." or ",".
Neither of these work
<TextBlock Text="{Binding CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator}"/>
<TextBlock Text="{Binding Source={x:Static CultureInfo.CurrentCulture.NumberFormat}, Path=NumberDecimalSeparator}"/>
CodePudding user response:
Use parentheses for the static property in the Path
xmlns:g="clr-namespace:System.Globalization;assembly=mscorlib"
<TextBlock Text="{Binding
Path=(g:CultureInfo.CurrentCulture).NumberFormat.NumberDecimalSeparator}"/>
or
<TextBlock Text="{Binding Source={x:Static g:CultureInfo.CurrentCulture},
Path=NumberFormat.NumberDecimalSeparator}"/>
CodePudding user response:
{x:Static }
works only with static
properties or fields
CurrentCulture is a static member of CultureInfo, but NumberFormat is an instance member
so the correct use will be:
<TextBlock Text="{Binding Source={x:Static g:CultureInfo.CurrentCulture}, Path=NumberFormat.NumberDecimalSeparator}"/>
where g
is a namespace definition which contains CurrentCulture class andshould be added on top level (xmlns:g="clr-namespace:System.Globalization;assembly=mscorlib"
)