/
MainWindow.xaml
99 lines (98 loc) · 6.74 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<Window x:Class="HierarchicalDataTemplateMode.MainWindow"
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:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:HierarchicalDataTemplateMode"
Title="MainWindow" Height="450" Width="700">
<Window.Resources>
<ResourceDictionary>
<local:States x:Key="states" />
<HierarchicalDataTemplate DataType="{x:Type local:ProjectObject}" ItemsSource="{Binding Stages}">
<dx:MeasurePixelSnapper>
<StackPanel Orientation="Vertical">
<ContentPresenter x:Name="defaultRowPresenter" Content="{Binding}" ContentTemplate="{Binding View.DefaultDataRowTemplate}" />
<Border Padding="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderBrush="#FFC3CEDC" BorderThickness="0,1,0,0">
<ProgressBar Height="5" Minimum="0" Maximum="100" Value="{Binding Row,Converter={local:ProjectObjectToProgressConverter}}" />
</Border>
</StackPanel>
</dx:MeasurePixelSnapper>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:ProjectStage}" ItemsSource="{Binding Tasks}">
<dx:MeasurePixelSnapper>
<StackPanel Orientation="Vertical">
<ContentPresenter x:Name="defaultRowPresenter" Content="{Binding}" ContentTemplate="{Binding View.DefaultDataRowTemplate}" />
<Border Padding="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderBrush="#FFC3CEDC" BorderThickness="0,1,0,0">
<ProgressBar Height="5" Minimum="0" Maximum="100" Value="{Binding Row,Converter={local:ProjectStageToProgressConverter}}" />
</Border>
</StackPanel>
</dx:MeasurePixelSnapper>
</HierarchicalDataTemplate>
<ControlTemplate x:Key="ComboBoxStateItemTemplate">
<StackPanel Orientation="Horizontal" Margin="3,0,0,0" Background="Transparent">
<dx:PixelSnapper>
<Image Height="16" Width="16" Source="{Binding Path=(dxe:BaseEdit.OwnerEdit).SelectedItem.Image}" />
</dx:PixelSnapper>
<TextBlock Margin="2" Text="{Binding Path=(dxe:BaseEdit.OwnerEdit).SelectedItem.TextValue}" VerticalAlignment="Center" />
</StackPanel>
</ControlTemplate>
<DataTemplate DataType="{x:Type local:Task}">
<StackPanel Orientation="Vertical">
<dx:MeasurePixelSnapper>
<ContentPresenter x:Name="defaultRowPresenter" Content="{Binding}" ContentTemplate="{Binding View.DefaultDataRowTemplate}" />
</dx:MeasurePixelSnapper>
<Border Padding="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderBrush="#FFC3CEDC" BorderThickness="0,1,0,0">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Margin="2,0" Orientation="Horizontal" Grid.Column="0" Grid.Row="0">
<TextBlock Text="StartDate:" FontWeight="Bold" />
<TextBlock Text="{Binding Row, StringFormat='MM/dd/yyyy',Converter={local:TaskToStartDateConverter}}" Margin="3,0,0,0" />
</StackPanel>
<StackPanel Margin="2,0" Orientation="Horizontal" Grid.Column="0" Grid.Row="1">
<TextBlock Text="EndDate:" FontWeight="Bold" />
<TextBlock Text="{Binding Row, StringFormat='MM/dd/yyyy',Converter={local:TaskToEndDateConverter}}" Margin="3,0,0,0" />
</StackPanel>
<dxe:ComboBoxEdit HorizontalAlignment="Right" VerticalAlignment="Center" MinWidth="100" Foreground="Black" IsTextEditable="False"
ItemsSource="{Binding DataSource, Source={StaticResource states}}"
DisplayTemplate="{StaticResource ComboBoxStateItemTemplate}"
EditNonEditableTemplate="{StaticResource ComboBoxStateItemTemplate}"
SelectedItem="{Binding Row, Mode=TwoWay,Converter={local:TaskToStateConverter}}"
Grid.Column="1" Grid.RowSpan="2">
<dxe:ComboBoxEdit.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<dx:MeasurePixelSnapper SnapperType="Around">
<Image Height="16" Width="16" Source="{Binding Image}" />
</dx:MeasurePixelSnapper>
<TextBlock Text="{Binding TextValue}" Margin="2" />
</StackPanel>
</DataTemplate>
</dxe:ComboBoxEdit.ItemTemplate>
</dxe:ComboBoxEdit>
</Grid>
</Border>
</StackPanel>
</DataTemplate>
</ResourceDictionary>
</Window.Resources>
<Grid>
<dxg:TreeListControl x:Name="treeList" ItemsSource="{Binding DataItems}" >
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn FieldName="Name" AllowSorting="True" />
<dxg:TreeListColumn FieldName="Executor" AllowSorting="True" />
</dxg:TreeListControl.Columns>
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="view" TreeDerivationMode="HierarchicalDataTemplate"
AllowEditing="True" NavigationStyle="Cell" />
</dxg:TreeListControl.View>
</dxg:TreeListControl>
</Grid>
</Window>