質問編集履歴
2
CollectionViewSourceの自動生成について
test
CHANGED
File without changes
|
test
CHANGED
@@ -305,3 +305,9 @@
|
|
305
305
|
</Window>
|
306
306
|
|
307
307
|
```
|
308
|
+
|
309
|
+
### CollectionViewSourceの自動生成
|
310
|
+
|
311
|
+
![イメージ説明](06129c1c1e08ccbac4acde88994f49a9.png)
|
312
|
+
|
313
|
+
データソースから追加すると、Window.Resourcesが自動で追加されました。
|
1
XAMLを補足しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -195,3 +195,113 @@
|
|
195
195
|
|
196
196
|
|
197
197
|
```
|
198
|
+
|
199
|
+
### 補足
|
200
|
+
|
201
|
+
```lang-XAML
|
202
|
+
|
203
|
+
<Window x:Class="ComboTest.MainWindow"
|
204
|
+
|
205
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
206
|
+
|
207
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
208
|
+
|
209
|
+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
210
|
+
|
211
|
+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
212
|
+
|
213
|
+
xmlns:local="clr-namespace:ComboTest"
|
214
|
+
|
215
|
+
mc:Ignorable="d"
|
216
|
+
|
217
|
+
Title="MainWindow" Height="450" Width="572.14" Loaded="Window_Loaded">
|
218
|
+
|
219
|
+
<Window.Resources>
|
220
|
+
|
221
|
+
<CollectionViewSource x:Key="personViewSource" d:DesignSource="{d:DesignInstance {x:Type local:Person}, CreateList=True}"/>
|
222
|
+
|
223
|
+
</Window.Resources>
|
224
|
+
|
225
|
+
<Grid>
|
226
|
+
|
227
|
+
<Grid x:Name="grid1" DataContext="{StaticResource personViewSource}" HorizontalAlignment="Left" Margin="302,96,0,0" VerticalAlignment="Top">
|
228
|
+
|
229
|
+
<Grid.ColumnDefinitions>
|
230
|
+
|
231
|
+
<ColumnDefinition Width="Auto"/>
|
232
|
+
|
233
|
+
<ColumnDefinition/>
|
234
|
+
|
235
|
+
</Grid.ColumnDefinitions>
|
236
|
+
|
237
|
+
<Grid.RowDefinitions>
|
238
|
+
|
239
|
+
<RowDefinition Height="Auto"/>
|
240
|
+
|
241
|
+
</Grid.RowDefinitions>
|
242
|
+
|
243
|
+
</Grid>
|
244
|
+
|
245
|
+
<Grid x:Name="grid2" DataContext="{StaticResource personViewSource}" HorizontalAlignment="Left" Margin="127,176,0,0" VerticalAlignment="Top">
|
246
|
+
|
247
|
+
<Grid.ColumnDefinitions>
|
248
|
+
|
249
|
+
<ColumnDefinition Width="Auto"/>
|
250
|
+
|
251
|
+
<ColumnDefinition Width="Auto"/>
|
252
|
+
|
253
|
+
</Grid.ColumnDefinitions>
|
254
|
+
|
255
|
+
<Grid.RowDefinitions>
|
256
|
+
|
257
|
+
<RowDefinition Height="Auto"/>
|
258
|
+
|
259
|
+
</Grid.RowDefinitions>
|
260
|
+
|
261
|
+
<Label Content="名前:" Grid.Column="0" HorizontalAlignment="Left" Margin="3" Grid.Row="0" VerticalAlignment="Center"/>
|
262
|
+
|
263
|
+
<TextBox x:Name="名前TextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="0" Text="{Binding 名前, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120"/>
|
264
|
+
|
265
|
+
</Grid>
|
266
|
+
|
267
|
+
<ComboBox x:Name="comboTest" HorizontalAlignment="Left" Margin="168,55,0,0" VerticalAlignment="Top" Width="120"/>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
<Grid x:Name="grid3" DataContext="{StaticResource personViewSource}" HorizontalAlignment="Left" Margin="86,140,0,0" VerticalAlignment="Top">
|
274
|
+
|
275
|
+
<Grid.ColumnDefinitions>
|
276
|
+
|
277
|
+
<ColumnDefinition Width="Auto"/>
|
278
|
+
|
279
|
+
<ColumnDefinition Width="Auto"/>
|
280
|
+
|
281
|
+
</Grid.ColumnDefinitions>
|
282
|
+
|
283
|
+
<Grid.RowDefinitions>
|
284
|
+
|
285
|
+
<RowDefinition Height="Auto"/>
|
286
|
+
|
287
|
+
</Grid.RowDefinitions>
|
288
|
+
|
289
|
+
<Label Content="Category ID:" Grid.Column="0" HorizontalAlignment="Left" Margin="3" Grid.Row="0" VerticalAlignment="Center"/>
|
290
|
+
|
291
|
+
<TextBox x:Name="categoryIDTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="0" Text="{Binding CategoryID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120"/>
|
292
|
+
|
293
|
+
</Grid>
|
294
|
+
|
295
|
+
<Button Content="登録" HorizontalAlignment="Left" Margin="174,231,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/>
|
296
|
+
|
297
|
+
<TextBlock HorizontalAlignment="Left" Margin="298,144,0,0" TextWrapping="Wrap" Text="バインドされている。" VerticalAlignment="Top" Height="23" Width="117"/>
|
298
|
+
|
299
|
+
<TextBlock HorizontalAlignment="Left" Margin="302,56,0,0" TextWrapping="Wrap" Text="バインドされていない。" VerticalAlignment="Top" Height="23" Width="122"/>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</Grid>
|
304
|
+
|
305
|
+
</Window>
|
306
|
+
|
307
|
+
```
|