回答編集履歴
1
見直しキャンペーン中
test
CHANGED
@@ -1,85 +1,43 @@
|
|
1
1
|
はっきり言って面倒くさいのですが、このように`ElementStyle`・`EditingElementStyle`を設定します。
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
```x
|
3
|
+
```xml
|
6
|
-
|
7
4
|
<Window
|
8
|
-
|
9
5
|
x:Class="Questions314501.MainWindow"
|
10
|
-
|
11
6
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
12
|
-
|
13
7
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
14
|
-
|
15
8
|
Width="800"
|
16
|
-
|
17
9
|
Height="450">
|
18
|
-
|
19
10
|
<Grid>
|
20
|
-
|
21
11
|
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding}">
|
22
|
-
|
23
12
|
<DataGrid.Resources>
|
24
|
-
|
25
13
|
<Style
|
26
|
-
|
27
14
|
x:Key="RightElementStyle"
|
28
|
-
|
29
15
|
BasedOn="{x:Static DataGridTextColumn.DefaultElementStyle}"
|
30
|
-
|
31
16
|
TargetType="TextBlock">
|
32
|
-
|
33
17
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
34
|
-
|
35
18
|
</Style>
|
36
|
-
|
37
19
|
<Style
|
38
|
-
|
39
20
|
x:Key="RightEditingElementStyle"
|
40
|
-
|
41
21
|
BasedOn="{x:Static DataGridTextColumn.DefaultEditingElementStyle}"
|
42
|
-
|
43
22
|
TargetType="TextBox">
|
44
|
-
|
45
23
|
<Setter Property="HorizontalContentAlignment" Value="Right" />
|
46
|
-
|
47
24
|
</Style>
|
48
|
-
|
49
25
|
</DataGrid.Resources>
|
50
|
-
|
51
26
|
<DataGrid.Columns>
|
52
|
-
|
53
27
|
<DataGridTextColumn Binding="{Binding Item1}" Header="Normal" />
|
54
|
-
|
55
28
|
|
56
|
-
|
57
29
|
<DataGridTextColumn
|
58
|
-
|
59
30
|
Binding="{Binding Item2}"
|
60
|
-
|
61
31
|
ElementStyle="{StaticResource RightElementStyle}"
|
62
|
-
|
63
32
|
Header="View Right" />
|
64
|
-
|
65
33
|
|
66
|
-
|
67
34
|
<DataGridTextColumn
|
68
|
-
|
69
35
|
Binding="{Binding Item3}"
|
70
|
-
|
71
36
|
EditingElementStyle="{StaticResource RightEditingElementStyle}"
|
72
|
-
|
73
37
|
ElementStyle="{StaticResource RightElementStyle}"
|
74
|
-
|
75
38
|
Header="View&Edit Right" />
|
76
|
-
|
77
39
|
</DataGrid.Columns>
|
78
|
-
|
79
40
|
</DataGrid>
|
80
|
-
|
81
41
|
</Grid>
|
82
|
-
|
83
42
|
</Window>
|
84
|
-
|
85
43
|
```
|