Mini Kabibi Habibi
<local:SchedulerDemoModule x:Class="SchedulerDemo.CellStyles"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
xmlns:collections="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler"
xmlns:dxschi="http://schemas.devexpress.com/winfx/2008/xaml/scheduler/internal"
xmlns:local="clr-namespace:SchedulerDemo"
xmlns:dxdb="http://schemas.devexpress.com/winfx/2008/xaml/demobase"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<local:SchedulerDemoModule.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/SchedulerDemo;component/Themes/Margin.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="LightBlueCellBrush" Color="#DEF0FF" />
<SolidColorBrush x:Key="LightLightBlueCellBrush" Color="#F2F9FF" />
<SolidColorBrush x:Key="BlueCellBrush" Color="#8CC5F5" />
<SolidColorBrush x:Key="LightRedCellBrush" Color="#FFE8FF" />
<SolidColorBrush x:Key="RedCellBrush" Color="#FFBFFE" />
<local:DateTimeToShortDateStringConverter x:Key="DateFormatConverter"></local:DateTimeToShortDateStringConverter>
<Style x:Key="DayViewCellStyle" TargetType="{x:Type dxschi:VisualTimeCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type dxschi:VisualTimeCell}">
<Grid x:Name="cell" SnapsToDevicePixels="True" Background="{StaticResource LightBlueCellBrush}" dxsch:SchedulerControl.HitTestType="Cell" IsHitTestVisible="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle x:Name="topBorder" Fill="{StaticResource BlueCellBrush}" Height="1" SnapsToDevicePixels="True" />
<ContentControl Grid.Row="1" x:Name="PART_CONTENT"
Content="{Binding}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
>
<ContentControl.ContentTemplate>
<DataTemplate>
<Rectangle MinHeight="30" HorizontalAlignment="Stretch" SnapsToDevicePixels="True" />
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
</Grid>
<Rectangle x:Name="leftBorder" Fill="{StaticResource BlueCellBrush}" Width="1" SnapsToDevicePixels="True" />
</Grid>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding IsWorkTime}" Value="False">
<Setter TargetName="cell" Property="Background" Value="{StaticResource LightRedCellBrush}" />
<Setter TargetName="leftBorder" Property="Fill" Value="{StaticResource RedCellBrush}" />
<Setter TargetName="topBorder" Property="Fill" Value="{StaticResource RedCellBrush}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="AllDayAreaCellStyle" TargetType="{x:Type dxschi:VisualAllDayAreaCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type dxschi:VisualAllDayAreaCell}">
<Grid SnapsToDevicePixels="True" Background="#8CC5F5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ContentControl x:Name="PART_CONTENT"
Content="{Binding}"
dxsch:SchedulerControl.HitTestType="AllDayArea"
IsHitTestVisible="True"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
SnapsToDevicePixels="True">
<ContentControl.ContentTemplate>
<DataTemplate>
<Rectangle SnapsToDevicePixels="True" Fill="Transparent" MinHeight="30" HorizontalAlignment="Stretch" />
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
<Rectangle Fill="Black" Height="1" SnapsToDevicePixels="True" Grid.Row="1" />
</Grid>
<Rectangle Fill="Black" Width="1" SnapsToDevicePixels="True" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="VerticalWeekCellStyle" TargetType="{x:Type dxschi:VisualDateCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type dxschi:VisualDateCell}">
<Grid x:Name="cell" SnapsToDevicePixels="True" Background="{StaticResource LightBlueCellBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="AUTO" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Margin="5"
Text="{Binding IntervalStart, Converter={StaticResource ResourceKey=DateFormatConverter}}"
Foreground="#8CC5F5"
FontSize="18"
IsHitTestVisible="True"
dxsch:SchedulerControl.HitTestType="DayHeader" />
<ContentControl x:Name="PART_CONTENT"
Grid.Row="1"
Content="{Binding Content}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
dxsch:SchedulerControl.HitTestType="Cell"
IsHitTestVisible="True">
<ContentControl.ContentTemplate>
<DataTemplate>
<Rectangle Fill="Transparent" />
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
</Grid>
<Rectangle Fill="{StaticResource BlueCellBrush}" Height="1" SnapsToDevicePixels="True" Grid.Row="1" />
</Grid>
<Rectangle Fill="{StaticResource BlueCellBrush}" Width="1" SnapsToDevicePixels="True" Grid.Column="1" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="HorizontalWeekCellTemplate" TargetType="{x:Type dxschi:VisualDateCell}">
<Grid x:Name="cell" SnapsToDevicePixels="True" Background="{StaticResource LightBlueCellBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Width="1" SnapsToDevicePixels="True" Grid.Column="0" Fill="{StaticResource BlueCellBrush}" />
<Grid Grid.Column="1" SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle x:Name="topBorder" Height="1" SnapsToDevicePixels="True" Fill="{StaticResource BlueCellBrush}" />
<Grid Grid.Row="1" SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="leftBorder" Background="{StaticResource BlueCellBrush}" SnapsToDevicePixels="True" dxsch:SchedulerControl.HitTestType="DayHeader" IsHitTestVisible="True">
<TextBlock Text="{Binding IntervalStart, Converter={StaticResource ResourceKey=DateFormatConverter}}" Padding="2" />
</Grid>
<ContentControl x:Name="PART_CONTENT"
Content="{Binding Content}"
Grid.Row="1"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
dxsch:SchedulerControl.HitTestType="Cell"
IsHitTestVisible="True" SnapsToDevicePixels="True">
<ContentControl.ContentTemplate>
<DataTemplate>
<Rectangle Fill="Transparent" />
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
</Grid>
</Grid>
</Grid>
</ControlTemplate>
<Style x:Key="HorizontalWeekCellStyle" TargetType="{x:Type dxschi:VisualDateCell}">
<Setter Property="NormalTemplate" Value="{StaticResource HorizontalWeekCellTemplate}"/>
<Setter Property="AlternateTemplate" Value="{StaticResource HorizontalWeekCellTemplate}"/>
</Style>
<Style x:Key="TimelineViewCellStyle" TargetType="{x:Type dxschi:VisualSingleTimelineCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type dxschi:VisualSingleTimelineCell}">
<Grid x:Name="cell" SnapsToDevicePixels="True" Background="{StaticResource LightBlueCellBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentControl Grid.Row="1"
x:Name="PART_CONTENT"
Content="{Binding}" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
dxsch:SchedulerControl.HitTestType="Cell"
IsHitTestVisible="True">
<ContentControl.ContentTemplate>
<DataTemplate>
<Rectangle Fill="Transparent" />
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
</Grid>
<Rectangle x:Name="bottomBorder" Fill="{StaticResource BlueCellBrush}" Height="1" SnapsToDevicePixels="True" Grid.Row="1" />
</Grid>
<Rectangle x:Name="rightBorder" Fill="{StaticResource BlueCellBrush}" Width="1" SnapsToDevicePixels="True" Grid.Column="1" />
</Grid>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding IsWorkTime}" Value="False">
<Setter TargetName="cell" Property="Background" Value="{StaticResource LightRedCellBrush}" />
<Setter TargetName="rightBorder" Property="Fill" Value="{StaticResource RedCellBrush}" />
<Setter TargetName="bottomBorder" Property="Fill" Value="{StaticResource RedCellBrush}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="SelectionTemplate">
<Grid IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Path Opacity="0.7" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Path.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#E3E3FF" Offset="0" />
<GradientStop Color="#ABACFF" Offset="0.5" />
<GradientStop Color="#E3E3FF" Offset="1" />
</LinearGradientBrush>
</Path.Fill>
<Path.Data>
<PathGeometry x:Name="Geometry" FillRule="Nonzero" />
</Path.Data>
</Path>
</Grid>
</ControlTemplate>
</ResourceDictionary>
</local:SchedulerDemoModule.Resources>
<dxdb:DemoModuleControl>
<dxdb:DemoModuleControl.OptionsContent>
<StackPanel>
<dx:GroupFrame Margin="{DynamicResource GroupMargin}" Header="Custom Templates" MinWidth="150">
<StackPanel>
<dxe:CheckEdit x:Name="chkCellStyles" Margin="{DynamicResource ElementMargin}" Content="Cell Styles" IsChecked="True" Checked="chkCellStyles_Checked" Unchecked="chkCellStyles_Unchecked" />
<dxe:CheckEdit x:Name="chkSelectionStyle" Margin="{DynamicResource ElementMargin}" Content="Selection Style" IsChecked="True" Checked="chkSelectionStyle_Checked" Unchecked="chkSelectionStyle_Unchecked" />
</StackPanel>
</dx:GroupFrame>
<dx:GroupFrame Margin="{DynamicResource GroupMargin}" Header="View Types" MinWidth="150">
<dxe:ListBoxEdit x:Name="viewType" Background="{x:Null}" ShowBorder="False" ValueMember="ViewType" DisplayMember="Caption" EditValue="{Binding Path=ActiveViewType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<dxe:ListBoxEdit.StyleSettings>
<dxe:RadioListBoxEditStyleSettings/>
</dxe:ListBoxEdit.StyleSettings>
<dxe:ListBoxEdit.ItemsSource>
<local:ObjectList>
<local:DemoViewTypeListItem Caption="Day View" ViewType="Day" />
<local:DemoViewTypeListItem Caption="Work Week" ViewType="WorkWeek" />
<local:DemoViewTypeListItem Caption="Week View" ViewType="Week" />
<local:DemoViewTypeListItem Caption="Month View" ViewType="Month" />
<local:DemoViewTypeListItem Caption="Timeline View" ViewType="Timeline" />
</local:ObjectList>
</dxe:ListBoxEdit.ItemsSource>
</dxe:ListBoxEdit>
</dx:GroupFrame>
</StackPanel>
</dxdb:DemoModuleControl.OptionsContent>
<dxsch:SchedulerControl x:Name="scheduler" ActiveViewType="Day" VerticalAlignment="Stretch">
</dxsch:SchedulerControl>
</dxdb:DemoModuleControl>
</local:SchedulerDemoModule>