回答編集履歴
1
見直しキャンペーン中
test
CHANGED
@@ -1,323 +1,162 @@
|
|
1
1
|
> カラムのWidthを0にすると右端にカラムwidth0のカラムが掴めないです。
|
2
|
-
|
3
|
-
|
4
2
|
|
5
3
|
日本語がおかしいですが、「右端**の**カラムのWidthを0にすると掴めない」ということでいいんでしょうか?
|
6
4
|
|
7
|
-
|
8
|
-
|
9
5
|
まあ右端じゃなくても掴めないんですが、右端以外は隣のカラムの移動?で結果的には表示されるようにはなりますね。
|
10
6
|
|
11
|
-
|
12
|
-
|
13
7
|
比較的簡単にできそうな方法として、右端じゃなくする方法を考えました。
|
14
|
-
|
15
8
|
右端にダミーの最大幅カラムを置き、リサイズ以外の操作を受け付けないような設定にします。
|
16
|
-
|
17
|
-
|
18
9
|
|
19
10
|
注)行選択のハイライトが貫通します(面倒なのでやりませんが、行とセルのスタイルをいじれば解消は可能と思われます)
|
20
11
|
|
21
12
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
```x
|
13
|
+
```xml
|
26
|
-
|
27
14
|
<Window
|
28
|
-
|
29
15
|
x:Class="Questions348202.MainWindow"
|
30
|
-
|
31
16
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
32
|
-
|
33
17
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
34
|
-
|
35
18
|
xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
|
36
|
-
|
37
19
|
Width="600"
|
38
|
-
|
39
20
|
Height="450">
|
40
|
-
|
41
21
|
<Window.Resources>
|
42
|
-
|
43
22
|
<Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
|
44
|
-
|
45
23
|
<Setter Property="Width" Value="8" />
|
46
|
-
|
47
24
|
<Setter Property="Background" Value="Transparent" />
|
48
|
-
|
49
25
|
<Setter Property="Cursor" Value="SizeWE" />
|
50
|
-
|
51
26
|
<Setter Property="Template">
|
52
|
-
|
53
27
|
<Setter.Value>
|
54
|
-
|
55
28
|
<ControlTemplate TargetType="{x:Type Thumb}">
|
56
|
-
|
57
29
|
<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" />
|
58
|
-
|
59
30
|
</ControlTemplate>
|
60
|
-
|
61
31
|
</Setter.Value>
|
62
|
-
|
63
32
|
</Setter>
|
64
|
-
|
65
33
|
</Style>
|
66
|
-
|
67
34
|
<Style x:Key="DataGridColumnHeaderStyle1" TargetType="{x:Type DataGridColumnHeader}">
|
68
|
-
|
69
35
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
70
|
-
|
71
36
|
<Setter Property="Template">
|
72
|
-
|
73
37
|
<Setter.Value>
|
74
|
-
|
75
38
|
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
|
76
|
-
|
77
39
|
<Grid>
|
78
|
-
|
79
40
|
<theme:DataGridHeaderBorder
|
80
|
-
|
81
41
|
Padding="{TemplateBinding Padding}"
|
82
|
-
|
83
42
|
Background="{TemplateBinding Background}"
|
84
|
-
|
85
43
|
BorderBrush="{TemplateBinding BorderBrush}"
|
86
|
-
|
87
44
|
BorderThickness="{TemplateBinding BorderThickness}"
|
88
|
-
|
89
45
|
IsClickable="False"
|
90
|
-
|
91
46
|
IsHovered="False"
|
92
|
-
|
93
47
|
IsPressed="False"
|
94
|
-
|
95
48
|
SeparatorBrush="{TemplateBinding SeparatorBrush}"
|
96
|
-
|
97
49
|
SeparatorVisibility="{TemplateBinding SeparatorVisibility}"
|
98
|
-
|
99
50
|
SortDirection="{TemplateBinding SortDirection}">
|
100
|
-
|
101
51
|
<ContentPresenter
|
102
|
-
|
103
52
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
104
|
-
|
105
53
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
106
|
-
|
107
54
|
RecognizesAccessKey="True"
|
108
|
-
|
109
55
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
110
|
-
|
111
56
|
</theme:DataGridHeaderBorder>
|
112
|
-
|
113
57
|
<Thumb
|
114
|
-
|
115
58
|
x:Name="PART_LeftHeaderGripper"
|
116
|
-
|
117
59
|
HorizontalAlignment="Left"
|
118
|
-
|
119
60
|
Style="{StaticResource ColumnHeaderGripperStyle}" />
|
120
|
-
|
121
61
|
<Thumb
|
122
|
-
|
123
62
|
x:Name="PART_RightHeaderGripper"
|
124
|
-
|
125
63
|
HorizontalAlignment="Right"
|
126
|
-
|
127
64
|
Style="{StaticResource ColumnHeaderGripperStyle}" />
|
128
|
-
|
129
65
|
</Grid>
|
130
|
-
|
131
66
|
</ControlTemplate>
|
132
|
-
|
133
67
|
</Setter.Value>
|
134
|
-
|
135
68
|
</Setter>
|
136
|
-
|
137
69
|
</Style>
|
138
|
-
|
139
70
|
</Window.Resources>
|
140
|
-
|
141
71
|
<Grid>
|
142
|
-
|
143
72
|
<Grid.RowDefinitions>
|
144
|
-
|
145
73
|
<RowDefinition />
|
146
|
-
|
147
74
|
<RowDefinition />
|
148
|
-
|
149
75
|
</Grid.RowDefinitions>
|
150
76
|
|
151
|
-
|
152
|
-
|
153
77
|
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Items}">
|
154
|
-
|
155
78
|
<DataGrid.Columns>
|
156
|
-
|
157
79
|
<DataGridTextColumn Binding="{Binding Column1}" Header="Column1" />
|
158
|
-
|
159
80
|
<DataGridTextColumn
|
160
|
-
|
161
81
|
Width="0"
|
162
|
-
|
163
82
|
MinWidth="0"
|
164
|
-
|
165
83
|
Binding="{Binding Column2}"
|
166
|
-
|
167
84
|
Header="Column2" />
|
168
|
-
|
169
85
|
<DataGridTextColumn Binding="{Binding Column3}" Header="Column3" />
|
170
|
-
|
171
86
|
<DataGridTextColumn
|
172
|
-
|
173
87
|
Width="0"
|
174
|
-
|
175
88
|
MinWidth="0"
|
176
|
-
|
177
89
|
Binding="{Binding Column4}"
|
178
|
-
|
179
90
|
Header="Column4" />
|
180
|
-
|
181
91
|
</DataGrid.Columns>
|
182
|
-
|
183
92
|
</DataGrid>
|
184
93
|
|
185
|
-
|
186
|
-
|
187
94
|
<DataGrid
|
188
|
-
|
189
95
|
Grid.Row="1"
|
190
|
-
|
191
96
|
AutoGenerateColumns="False"
|
192
|
-
|
193
97
|
ItemsSource="{Binding Items}">
|
194
|
-
|
195
98
|
<DataGrid.Columns>
|
196
|
-
|
197
99
|
<DataGridTextColumn Binding="{Binding Column1}" Header="Column1" />
|
198
|
-
|
199
100
|
<DataGridTextColumn
|
200
|
-
|
201
101
|
Width="0"
|
202
|
-
|
203
102
|
MinWidth="0"
|
204
|
-
|
205
103
|
Binding="{Binding Column2}"
|
206
|
-
|
207
104
|
Header="Column2" />
|
208
|
-
|
209
105
|
<DataGridTextColumn Binding="{Binding Column3}" Header="Column3" />
|
210
|
-
|
211
106
|
<DataGridTextColumn
|
212
|
-
|
213
107
|
Width="0"
|
214
|
-
|
215
108
|
MinWidth="0"
|
216
|
-
|
217
109
|
Binding="{Binding Column4}"
|
218
|
-
|
219
110
|
Header="Column4" />
|
220
|
-
|
221
111
|
<DataGridTextColumn
|
222
|
-
|
223
112
|
Width="*"
|
224
|
-
|
225
113
|
CanUserReorder="False"
|
226
|
-
|
227
114
|
CanUserSort="False"
|
228
|
-
|
229
115
|
HeaderStyle="{StaticResource DataGridColumnHeaderStyle1}"
|
230
|
-
|
231
116
|
IsReadOnly="True" />
|
232
|
-
|
233
117
|
</DataGrid.Columns>
|
234
|
-
|
235
118
|
</DataGrid>
|
236
|
-
|
237
119
|
</Grid>
|
238
|
-
|
239
120
|
</Window>
|
240
|
-
|
241
121
|
```
|
242
122
|
|
243
|
-
|
244
|
-
|
245
|
-
```
|
123
|
+
```cs
|
246
|
-
|
247
124
|
using System.Collections.Generic;
|
248
|
-
|
249
125
|
using System.Linq;
|
250
|
-
|
251
126
|
using System.Windows;
|
252
127
|
|
253
|
-
|
254
|
-
|
255
128
|
namespace Questions348202
|
256
|
-
|
257
129
|
{
|
258
|
-
|
259
130
|
public class Item
|
260
|
-
|
261
131
|
{
|
262
|
-
|
263
132
|
public string Column1 { get; }
|
264
|
-
|
265
133
|
public string Column2 { get; }
|
266
|
-
|
267
134
|
public string Column3 { get; }
|
268
|
-
|
269
135
|
public string Column4 { get; }
|
270
136
|
|
271
|
-
|
272
|
-
|
273
137
|
public Item(int x)
|
274
|
-
|
275
138
|
{
|
276
|
-
|
277
139
|
Column1 = $"Column1-{x}";
|
278
|
-
|
279
140
|
Column2 = $"Column2-{x}";
|
280
|
-
|
281
141
|
Column3 = $"Column3-{x}";
|
282
|
-
|
283
142
|
Column4 = $"Column4-{x}";
|
284
|
-
|
285
143
|
}
|
286
|
-
|
287
144
|
}
|
288
145
|
|
289
|
-
|
290
|
-
|
291
146
|
public partial class MainWindow : Window
|
292
|
-
|
293
147
|
{
|
294
|
-
|
295
148
|
public List<Item> Items { get; } = Enumerable.Range(1, 10).Select(x => new Item(x)).ToList();
|
296
|
-
|
297
149
|
public MainWindow()
|
298
|
-
|
299
150
|
{
|
300
|
-
|
301
151
|
InitializeComponent();
|
302
|
-
|
303
152
|
DataContext = this;
|
304
|
-
|
305
153
|
}
|
306
|
-
|
307
154
|
}
|
308
|
-
|
309
155
|
}
|
310
|
-
|
311
156
|
```
|
312
|
-
|
313
157
|
![アプリ画像](dedba26ef3f358b2853d89fcf6c8aa24.png)
|
314
|
-
|
315
|
-
|
316
158
|
|
317
159
|
---
|
318
160
|
|
319
|
-
|
320
|
-
|
321
161
|
ほかの質問ですが「追記・修正依頼」にも答えず、放置状態なのはなぜなんでしょうか?
|
322
|
-
|
323
162
|
スコアもマイナスになっていますし、そのうち相手にされなくなりますよ。
|