I'm trying to set as DatePicker
locale the CurrentCulture
, what I did so far:
XAML Definition
xmlns:glob="clr-namespace:System.Globalization;assembly=mscorlib"
DatePicker structure
<DatePicker Language="{Binding Source={x:Static glob:CultureInfo.CurrentCulture}}" />
the problem's I got this exception:
System.Windows.Data Error: 1 : Cannot create default converter to perform 'one-way' conversions between types 'System.Globalization.CultureInfo' and 'System.Windows.Markup.XmlLanguage'. Consider using Converter property of Binding. BindingExpression:Path=; DataItem='CultureInfo' (HashCode=-1158415740); target element is 'DatePicker' (Name='MatchCalendarDate'); target property is 'Language' (type 'XmlLanguage') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='it-IT' BindingExpression:Path=; DataItem='CultureInfo' (HashCode=-1158415740); target element is 'DatePicker' (Name='MatchCalendarDate'); target property is 'Language' (type 'XmlLanguage')
Note that I'm using as DatePicker
control the MahApp.