【发布时间】:2013-10-17 00:31:13
【问题描述】:
我无法更改 Telerik DatePicker 中的日期格式。 我正在尝试以下程序。 我找到了以下代码here
public class TelerikDateFormatWorkaround
{
public CultureInfo CultureWithSwissFormat
{
//Hack to get around the fact that there is no custom date format in the Telerik DatePicker
//http://www.telerik.com/community/forums/wpf/datepicker/changing-dateformat.aspx
get
{
var tempCultureInfo = (CultureInfo) CultureInfo.CurrentCulture.Clone();
tempCultureInfo.DateTimeFormat.ShortDatePattern = "dd.MM.yyyy";
return tempCultureInfo;
}
}
}
<Window.Resources>
<Style TargetType="telerik:RadDatePicker">
<Setter Property="Culture" Value="{Binding Source={StaticResource TelerikDateFormatWorkaround}, Path=CultureWithSwissFormat}"/>
</Style>
</Window.Resources>
但我有以下错误The TelerikDateFormatWorkaround was not found.
你能帮帮我吗?
【问题讨论】:
-
请注意您链接的示例中的注释声明“将其添加到用户控件资源”。你在哪里做这个?代码段长什么样子?
-
在
TargetType="telerik:RadDatePicker"
标签: c# wpf xaml telerik datepicker