Below is the complete XAML code of the default style of the cell presenter.
XAML
Copy Code
|
---|
<Style TargetType="local:CellPresenter" x:Key="SimpleCellStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:CellPresenter">
<Border DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{Binding CellStyle.BorderBrush}" BorderThickness="{Binding CellStyle.BorderThickness}" Background="{Binding Background}" Margin="{Binding CellStyle.Margin}" />
</ControlTemplate> </Setter.Value> </Setter> </Style>
<Style TargetType="local:CellPresenter" x:Key="TodayCellStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:CellPresenter">
<Border DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{Binding CellStyle.BorderThickness}" Margin="{Binding CellStyle.Margin}" Padding="{Binding CellStyle.ContentMargin}"> <Border BorderBrush="{Binding CellSettings.TodayBrush}" BorderThickness="{Binding CellHeaderStyle.BorderThickness}" Background="{Binding CellSettings.TodayFillBrush}" Margin="{Binding CellHeaderStyle.Margin}" Width="{Binding HeaderWidth}" Height="{Binding HeaderHeight}" VerticalAlignment="{Binding HeaderVerticalAlignment}" HorizontalAlignment="{Binding HeaderHorizontalAlignment}" /> </Border>
</ControlTemplate> </Setter.Value> </Setter> </Style>
<Style TargetType="local:CellPresenter" x:Key="WithHeaderCellStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:CellPresenter"> <Border DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{Binding CellStyle.BorderBrush}" BorderThickness="{Binding CellStyle.BorderThickness}" Background="{Binding Background}" Margin="{Binding CellStyle.Margin}" Padding="{Binding CellStyle.ContentMargin}"> <Border BorderBrush="{Binding CellHeaderStyle.BorderBrush}" BorderThickness="{Binding CellHeaderStyle.BorderThickness}" Background="{Binding CellHeaderStyle.Background}" Margin="{Binding CellHeaderStyle.Margin}" Width="{Binding HeaderWidth}" Height="{Binding HeaderHeight}" VerticalAlignment="{Binding HeaderVerticalAlignment}" HorizontalAlignment="{Binding HeaderHorizontalAlignment}"> <TextBlock FontFamily="{Binding CellHeaderStyle.FontFamily}" FontSize="{Binding CellHeaderStyle.FontSize}" FontStretch="{Binding CellHeaderStyle.FontStretch}" FontStyle="{Binding CellHeaderStyle.FontStyle}" FontWeight="{Binding CellHeaderStyle.FontWeight}" Foreground="{Binding CellHeaderStyle.Foreground}" TextAlignment="{Binding CellHeaderStyle.TextAlignment}" VerticalAlignment="{Binding CellHeaderStyle.VerticalAlignment}" HorizontalAlignment="{Binding CellHeaderStyle.HorizontalAlignment}" Margin="{Binding CellHeaderStyle.ContentMargin}" Text="{Binding HeaderText}"> </TextBlock> </Border> </Border>
</ControlTemplate> </Setter.Value> </Setter> </Style> |
The local namespace is defined as follows:
XAML
Copy Code
|
---|
xmlns:local="clr-namespace:MindFusion.Scheduling.Silverlight" |
As can be seen in the above XAML, there are several styles supplying different control templates for the cells in different views. For example, the first style supplies the template of cells in the Resource and Timetable views. Those are the cells without headers. The next style supplies the template of cells that can have headers. Those are the cells in the SingleMonth, MonthRange, List and WeekRange views. The last style supplies the template for the cell representing the current day.
The following table illustrates the presentation of a cell in the three different templates:
Condition | Presentation |
---|
StyleKey=Simple | |
StyleKey=Today | |
StyleKey=WithHeader | |