Hi,
I messed around a lot with the Calendar but I can't get it working with DayButtonStyleSelector.
I created a new project, added a StyleSelector class and tried to use it -- SelectStyle is never called.
My XAML:
My Style selector Class:
I use 2012.2.1015.40
Manfred
I messed around a lot with the Calendar but I can't get it working with DayButtonStyleSelector.
I created a new project, added a StyleSelector class and tried to use it -- SelectStyle is never called.
My XAML:
<Window x:Class="WpfApplication1.MainWindow" xmlns:VMs="clr-namespace:WpfApplication1" xmlns:calendar="clr-namespace:Telerik.Windows.Controls.Calendar;assembly=Telerik.Windows.Controls.Input" Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> <Grid> <Grid.Resources> <VMs:MyStyleSelector x:Key="stsWeekend"> <VMs:MyStyleSelector.SpecialStyle> <Style TargetType="{x:Type calendar:CalendarButton}"> <Setter Property="Background"> <Setter.Value> <SolidColorBrush Color="Orange" Opacity="0.6"/> </Setter.Value> </Setter> </Style> </VMs:MyStyleSelector.SpecialStyle> </VMs:MyStyleSelector> </Grid.Resources> <telerik:RadCalendar HorizontalAlignment="Left" Margin="68,96,0,0" Name="radCalendar1" VerticalAlignment="Top" DayButtonStyleSelector="{StaticResource stsWeekend}"/> </Grid></Window>My Style selector Class:
namespace WpfApplication1 { public class MyStyleSelector : System.Windows.Controls.StyleSelector { public override Style SelectStyle(object item, DependencyObject container) { CalendarButtonContent content = item as CalendarButtonContent; if(content != null) { if(content.Date.DayOfWeek == DayOfWeek.Tuesday && content.ButtonType == CalendarButtonType.Date) { return SpecialStyle; } } return base.SelectStyle(item, container); } public Style SpecialStyle { get; set; } }}I use 2012.2.1015.40
Manfred