3
我正在爲我的WindowsPhone應用程序使用Telerik的RadCalendar控件。我想更改WindowsPhone RadCalendar中的SelectedDate背景顏色...有什麼方法可以改變它嗎?如何在Windows Phone中更改RadCalendar的選定顏色?
我正在爲我的WindowsPhone應用程序使用Telerik的RadCalendar控件。我想更改WindowsPhone RadCalendar中的SelectedDate背景顏色...有什麼方法可以改變它嗎?如何在Windows Phone中更改RadCalendar的選定顏色?
您可以通過使用特殊模板更改SelectedDay的屬性。這是一天一個樣本數據模板:一個特殊的模板的週末
<?xml version="1.0" encoding="utf-8"?>
<UserControl.Resources>
<local:WeekendDaySelector x:Key="WeekendDaySelector">
<local:WeekendDaySelector.SpecialTemplate>
<DataTemplate>
<Grid Margin="5">
<Image Source="/Calendar/Images/SpecialDay.png" Width="24" Height="24" />
<TextBlock Text="{Binding Text}" x:Name="TextPresenter" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
</Grid>
</DataTemplate>
</local:WeekendDaySelector.SpecialTemplate>
</local:WeekendDaySelector>
</UserControl.Resources>
<telerikInput:RadCalendar ItemTemplateSelector="{StaticResource WeekendDaySelector}" />
現在模板選擇
public class WeekendDaySelector : DataTemplateSelector
{
public DataTemplate SpecialTemplate
{
get;
set;
}
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
CalendarButtonContentInfo info = item as CalendarButtonContentInfo;
CalendarButton button = container as CalendarButton;
if (!button.IsFromCurrentView) return null;
if (info.Date == null) return null;
if (info.Date.Value.DayOfWeek == DayOfWeek.Saturday ||
info.Date.Value.DayOfWeek == DayOfWeek.Sunday)
{
return SpecialTemplate;
}
return base.SelectTemplate(item, container);
}
}
您可以瞭解更多的this thread
<telerikInput:RadCalendar>
<telerikInput:RadCalendar.ItemTemplate>
<DataTemplate>
<Grid Margin="5">
<TextBlock Text="{Binding DetailText}" FontSize="7" MaxHeight="25" VerticalAlignment="Top" Margin="0,-2,0,0" />
<TextBlock Text="{Binding Text}" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
</Grid>
</DataTemplate>
</telerikInput:RadCalendar.ItemTemplate>
</telerikInput:RadCalendar>
例。