-
Notifications
You must be signed in to change notification settings - Fork 2
/
MainWindow.xaml
103 lines (99 loc) · 6.46 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
100
101
102
103
<syncfusion:ChromelessWindow x:Class="Merging.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:helper="using:Syncfusion.UI.Xaml.Grid"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:local="clr-namespace:Merging"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
syncfusion:LayoutControl.SetMetroMode="True"
Icon="App.ico">
<syncfusion:ChromelessWindow.Resources>
<local:EmployeeRepository x:Key="viewModel" />
<local:CurrencyFormatConverter x:Key="CurrencyConverter" />
<local:EditTriggerOptionConverter x:Key="EditTriggerOptionConverter" />
<Style TargetType="syncfusion:TreeGridExpanderCell" x:Key="customCellStyles">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=HasChildNodes, RelativeSource={RelativeSource Self}}" Value="true">
<Setter Property="FontWeight" Value="Bold" />
</DataTrigger>
</Style.Triggers>
</Style>
</syncfusion:ChromelessWindow.Resources>
<Window.DataContext>
<local:EmployeeRepository />
</Window.DataContext>
<Grid>
<syncfusion:LayoutControl HeaderDescriptionText="This sample showcases the merging capabilities in SfTreeGrid."
HeaderText="Cell Merge"
LayoutMode="Metro"
UserOptionsVisibility="Collapsed">
<syncfusion:LayoutControl.GridView>
<syncfusion:SfTreeGrid Name="treeGrid"
AllowEditing="{Binding IsChecked,
Mode=TwoWay,
ElementName=checkBox}"
AllowSorting="True"
AutoExpandMode="RootNodesExpanded"
ColumnSizer="Star"
AutoGenerateColumns="False"
ChildPropertyName="Children"
EditTrigger="{Binding SelectedIndex,
Mode=TwoWay,
ElementName=EditTriggerComboBox,
Converter={StaticResource EditTriggerOptionConverter}}"
ItemsSource="{Binding EmployeeDetails}"
ExpanderCellStyle="{StaticResource customCellStyles}"
LiveNodeUpdateMode="AllowDataShaping">
<interactivity:Interaction.Behaviors>
<local:RequestTreeItemsBehavior />
<local:QueryCoveredRangeBehavior />
</interactivity:Interaction.Behaviors>
<syncfusion:SfTreeGrid.Columns>
<syncfusion:TreeGridTextColumn Width="150" MappingName="Title" />
<syncfusion:TreeGridTextColumn HeaderText="First Name" MappingName="FirstName" />
<syncfusion:TreeGridTextColumn HeaderText="Last Name" MappingName="LastName" />
<syncfusion:TreeGridTemplateColumn HeaderText="Employee ID" MappingName="EmpId">
<syncfusion:TreeGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding EmpId}" />
</DataTemplate>
</syncfusion:TreeGridTemplateColumn.CellTemplate>
<syncfusion:TreeGridTemplateColumn.EditTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
FocusManager.FocusedElement="{Binding ElementName=textBox}">
<TextBox x:Name="textBox"
FontStyle="Italic"
FontWeight="SemiBold"
Padding="2,0"
Text="{Binding Id,
Mode=TwoWay}" />
</Grid>
</DataTemplate>
</syncfusion:TreeGridTemplateColumn.EditTemplate>
</syncfusion:TreeGridTemplateColumn>
<syncfusion:TreeGridDateTimeColumn Width="150" MappingName="DOJ" HeaderText="Date of Joining">
</syncfusion:TreeGridDateTimeColumn>
<syncfusion:TreeGridNumericColumn Width="100" MappingName="Rating">
</syncfusion:TreeGridNumericColumn>
<syncfusion:TreeGridNumericColumn MappingName="Salary">
<syncfusion:TreeGridNumericColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock HorizontalAlignment="Right"
VerticalAlignment="Center"
Text="{Binding Salary,
Converter={StaticResource CurrencyConverter}}"
TextAlignment="Center" />
</Grid>
</DataTemplate>
</syncfusion:TreeGridNumericColumn.CellTemplate>
</syncfusion:TreeGridNumericColumn>
<syncfusion:TreeGridTextColumn MappingName="Hike" />
</syncfusion:SfTreeGrid.Columns>
</syncfusion:SfTreeGrid>
</syncfusion:LayoutControl.GridView>
</syncfusion:LayoutControl>
</Grid>
</syncfusion:ChromelessWindow>