Is it possible set specific culture for DateTimePicker
control? I would like use this specific culture on format name of moths and time format. For Example I create specific culture:
CultureInfo.GetCultur开发者_运维问答eInfo("sk-Sk");
Thanks for advice.
You could try adding:
FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new FrameworkPropertyMetadata(
XmlLanguage.GetLanguage("sk-Sk")));
or
FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new FrameworkPropertyMetadata(
XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
to your applications StartupEventHandler
public App()
{
DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
Startup += new StartupEventHandler(App_Startup);
}
protected override void OnStartup(StartupEventArgs e)
{
FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new FrameworkPropertyMetadata(
XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
base.OnStartup(e);
}
This should set the culture info for all WPF controls (not sure if you really want to just change the culture for the DateTimePicker)
精彩评论