11
11
<vm : DataGridViewModel />
12
12
</Design .DataContext>
13
13
14
- <StackPanel Margin =" 20" Spacing =" 30" >
15
- <DataGrid ItemsSource =" {Binding Items}"
16
- Height =" 150"
17
- IsReadOnly =" False" >
18
- <DataGrid .Columns>
19
- <DataGridTemplateColumn Header =" " >
20
- <DataGridTemplateColumn .CellTemplate>
21
- <DataTemplate >
22
- <Svg Path =" /Assets/Computer.svg" Width =" 16" Height =" 16" Css =" .st0 {fill: #3B86EA}" />
23
- </DataTemplate >
24
- </DataGridTemplateColumn .CellTemplate>
25
- </DataGridTemplateColumn >
26
- <DataGridTextColumn Header =" Type" Binding =" {Binding ItemType}" />
27
- <DataGridTextColumn Header =" Common Name" Binding =" {Binding CommonName}" />
28
- <DataGridTextColumn Header =" Account Name" Binding =" {Binding AccountName}" />
29
- <DataGridTextColumn Header =" Last Modified" Binding =" {Binding LastModified}" IsReadOnly =" True" />
30
- </DataGrid .Columns>
31
- </DataGrid >
32
- <StackPanel Spacing =" 10" >
33
- <TextBlock >With <TextBlock Classes =" code" Text =" Classes='cell-selectable-style'" /></TextBlock >
34
- <DataGrid ItemsSource =" {Binding Items}"
35
- Classes =" cell-selectable-style"
36
- IsReadOnly =" False" >
37
- <DataGrid .Columns>
38
- <DataGridTemplateColumn Header =" " >
39
- <DataGridTemplateColumn .CellTemplate>
40
- <DataTemplate >
41
- <Svg Path =" /Assets/Computer.svg" Width =" 16" Height =" 16" Css =" .st0 {fill: #3B86EA}" />
42
- </DataTemplate >
43
- </DataGridTemplateColumn .CellTemplate>
44
- </DataGridTemplateColumn >
45
- <DataGridTextColumn Header =" Type" Binding =" {Binding ItemType}" />
46
- <DataGridTextColumn Header =" Common Name" Binding =" {Binding CommonName}" />
47
- <DataGridTextColumn Header =" Account Name" Binding =" {Binding AccountName}" />
48
- <DataGridTextColumn Header =" Last Modified" Binding =" {Binding LastModified}" IsReadOnly =" True" />
49
- </DataGrid .Columns>
50
- </DataGrid >
51
- </StackPanel >
52
- </StackPanel >
14
+ <TabControl TabStripPlacement =" Top" Margin =" 20" >
15
+ <TabItem Header =" DataGrid" >
16
+ <StackPanel Margin =" 20" Spacing =" 30" >
17
+ <DataGrid ItemsSource =" {Binding Items}"
18
+ Height =" 150"
19
+ IsReadOnly =" False" >
20
+ <DataGrid .Columns>
21
+ <DataGridTemplateColumn Header =" " >
22
+ <DataGridTemplateColumn .CellTemplate>
23
+ <DataTemplate >
24
+ <Svg Path =" /Assets/Computer.svg" Width =" 16" Height =" 16" Css =" .st0 {fill: #3B86EA}" />
25
+ </DataTemplate >
26
+ </DataGridTemplateColumn .CellTemplate>
27
+ </DataGridTemplateColumn >
28
+ <DataGridTextColumn Header =" Type" Binding =" {Binding ItemType}" Width =" *" />
29
+ <DataGridTextColumn Header =" Common Name" Binding =" {Binding CommonName}" Width =" *" />
30
+ <DataGridTextColumn Header =" Account Name" Binding =" {Binding AccountName}" Width =" *" />
31
+ <DataGridTextColumn Header =" Last Modified" Binding =" {Binding LastModified}" IsReadOnly =" True" Width =" *" />
32
+ </DataGrid .Columns>
33
+ </DataGrid >
34
+ <StackPanel Spacing =" 10" >
35
+ <TextBlock >With <TextBlock Classes =" code" Text =" Classes='cell-selectable-style'" /></TextBlock >
36
+ <DataGrid ItemsSource =" {Binding Items}"
37
+ Classes =" cell-selectable-style"
38
+ IsReadOnly =" False" >
39
+ <DataGrid .Columns>
40
+ <DataGridTemplateColumn Header =" " >
41
+ <DataGridTemplateColumn .CellTemplate>
42
+ <DataTemplate >
43
+ <Svg Path =" /Assets/Computer.svg" Width =" 16" Height =" 16" Css =" .st0 {fill: #3B86EA}" />
44
+ </DataTemplate >
45
+ </DataGridTemplateColumn .CellTemplate>
46
+ </DataGridTemplateColumn >
47
+ <DataGridTextColumn Header =" Type" Binding =" {Binding ItemType}" Width =" *" />
48
+ <DataGridTextColumn Header =" Common Name" Binding =" {Binding CommonName}" Width =" *" />
49
+ <DataGridTextColumn Header =" Account Name" Binding =" {Binding AccountName}" Width =" *" />
50
+ <DataGridTextColumn Header =" Last Modified" Binding =" {Binding LastModified}" IsReadOnly =" True" Width =" *" />
51
+ </DataGrid .Columns>
52
+ </DataGrid >
53
+ </StackPanel >
54
+ </StackPanel >
55
+ </TabItem >
56
+ <TabItem Header =" Non-Distributed Columns" >
57
+ <StackPanel Margin =" 20" Spacing =" 10" >
58
+ <TextBlock ><Bold >NOTE:</Bold > When none of the columns are sized to fill the width of the table (<TextBlock Classes =" code" Text =" Width='*'" />), the right row margins are too large</TextBlock >
59
+ <DataGrid ItemsSource =" {Binding Items}" >
60
+ <DataGrid .Columns>
61
+ <DataGridTemplateColumn Header =" " >
62
+ <DataGridTemplateColumn .CellTemplate>
63
+ <DataTemplate >
64
+ <Svg Path =" /Assets/Computer.svg" Width =" 16" Height =" 16" Css =" .st0 {fill: #3B86EA}" />
65
+ </DataTemplate >
66
+ </DataGridTemplateColumn .CellTemplate>
67
+ </DataGridTemplateColumn >
68
+ <DataGridTextColumn Header =" Type" Binding =" {Binding ItemType}" />
69
+ <DataGridTextColumn Header =" Common Name" Binding =" {Binding CommonName}" />
70
+ <DataGridTextColumn Header =" Account Name" Binding =" {Binding AccountName}" />
71
+ <DataGridTextColumn Header =" Last Modified" Binding =" {Binding LastModified}" IsReadOnly =" True" />
72
+ </DataGrid .Columns>
73
+ </DataGrid >
74
+ <TextBlock >This can be fixed by applying <TextBlock Classes =" code" Text =" Classes='MacOS_NonDistributed_Columns'" />:</TextBlock >
75
+ <DataGrid ItemsSource =" {Binding Items}"
76
+ Classes =" MacOS_NonDistributed_Columns" >
77
+ <DataGrid .Columns>
78
+ <DataGridTemplateColumn Header =" " >
79
+ <DataGridTemplateColumn .CellTemplate>
80
+ <DataTemplate >
81
+ <Svg Path =" /Assets/Computer.svg" Width =" 16" Height =" 16" Css =" .st0 {fill: #3B86EA}" />
82
+ </DataTemplate >
83
+ </DataGridTemplateColumn .CellTemplate>
84
+ </DataGridTemplateColumn >
85
+ <DataGridTextColumn Header =" Type" Binding =" {Binding ItemType}" />
86
+ <DataGridTextColumn Header =" Common Name" Binding =" {Binding CommonName}" />
87
+ <DataGridTextColumn Header =" Account Name" Binding =" {Binding AccountName}" />
88
+ <DataGridTextColumn Header =" Last Modified" Binding =" {Binding LastModified}" IsReadOnly =" True" />
89
+ </DataGrid .Columns>
90
+ </DataGrid >
91
+ </StackPanel >
92
+ </TabItem >
93
+ </TabControl >
53
94
</UserControl >
0 commit comments