/
MainWindow.xaml
75 lines (74 loc) · 4.31 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<Window x:Class="SchedulerCellTemplate.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SchedulerCellTemplate"
mc:Ignorable="d"
xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduling"
xmlns:dxschv="http://schemas.devexpress.com/winfx/2008/xaml/scheduling/visual"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
DataContext="{dxmvvm:ViewModelSource local:CellCustomizationDemoViewModel}"
Title="MainWindow" Height="700" Width="900">
<Window.Resources>
<SolidColorBrush x:Key="LunchBackground" Color="Blue" Opacity="0.4"/>
<Style x:Key="CellControl.Style" TargetType="dxschv:CellControl">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<local:CellControlDecorator LunchBrush="{StaticResource LunchBackground}"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="dxsch:DayView">
<Style.Triggers>
<DataTrigger Binding="{Binding HighlightLunchHours}" Value="True">
<Setter Property="CellStyle" Value="{StaticResource CellControl.Style}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<DockPanel>
<dxlc:LayoutControl DockPanel.Dock="Right" Orientation="Vertical" VerticalAlignment="Top" Padding="0" MinWidth="200">
<dxe:CheckEdit Content="Highlight Lunch Hours" IsChecked="{Binding HighlightLunchHours, Mode=TwoWay}" Margin="4,0,0,0"/>
<dxlc:LayoutItem Label="Lunch Start">
<dxe:TextEdit EditValue="{Binding LunchStart, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, Converter={local:TimeSpanToDateTimeConverter}}"
Mask="hh:mm:ss" MaskType="DateTime" MaskUseAsDisplayFormat="True" Margin="4,0,4,0" />
</dxlc:LayoutItem>
<dxlc:LayoutItem Label="Lunch End">
<dxe:TextEdit EditValue="{Binding LunchEnd, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, Converter={local:TimeSpanToDateTimeConverter}}"
Mask="hh:mm:ss" MaskType="DateTime" MaskUseAsDisplayFormat="True" Margin="4,0,4,0" />
</dxlc:LayoutItem>
</dxlc:LayoutControl>
<dxsch:SchedulerControl x:Name="scheduler" GroupType="Resource" Start="{Binding Start, Mode=TwoWay}" AllowAppointmentConflicts="True">
<dxsch:DayView
x:Name="dayView" ResourcesPerPage="2" TimeIndicatorVisibility="Never" TimeMarkerVisibility="Never"
SnapToCellsMode="Never" DayCount="5" TimeScale="00:30:00" />
<dxsch:SchedulerControl.DataSource>
<dxsch:DataSource AppointmentsSource="{Binding Appointments}" ResourcesSource="{Binding Calendars}">
<dxsch:DataSource.AppointmentMappings>
<dxsch:AppointmentMappings
Id="Id"
AllDay="AllDay"
Type="AppointmentType"
Start="Start"
End="End"
Subject="Subject"
Description="Description"
Location="Location"
ResourceId="CalendarId"
RecurrenceInfo="RecurrenceInfo"
StatusId="Status"
LabelId="Label"/>
</dxsch:DataSource.AppointmentMappings>
<dxsch:DataSource.ResourceMappings>
<dxsch:ResourceMappings Id="Id" Caption="Name"/>
</dxsch:DataSource.ResourceMappings>
</dxsch:DataSource>
</dxsch:SchedulerControl.DataSource>
</dxsch:SchedulerControl>
</DockPanel>
</Window>