質問編集履歴

1

ソース追加

2015/09/02 02:37

投稿

yisland
yisland

スコア28

test CHANGED
File without changes
test CHANGED
@@ -9,3 +9,191 @@
9
9
  WPFのDataGrid内に動的に生成したコンボボックスを表示させる方法が分かりません。
10
10
 
11
11
  どなたか分かる方がいらしたら教えて頂きたいです。
12
+
13
+
14
+
15
+ **追加**
16
+
17
+ ```
18
+
19
+ <Window x:Class="Window2"
20
+
21
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
+
23
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
24
+
25
+ Title="Window2" Height="383" Width="666">
26
+
27
+ <StackPanel Orientation="Vertical">
28
+
29
+
30
+
31
+ <DataGrid Grid.Row="1" Name="DataGrid1" AutoGenerateColumns="False" Height="300" >
32
+
33
+ <DataGrid.Columns>
34
+
35
+ <DataGridTemplateColumn>
36
+
37
+ <DataGridTemplateColumn.Header>
38
+
39
+ <Grid>
40
+
41
+ <Grid.RowDefinitions>
42
+
43
+ <RowDefinition />
44
+
45
+ <RowDefinition />
46
+
47
+ </Grid.RowDefinitions>
48
+
49
+ <Label Grid.Row="0" Grid.RowSpan="2" Content="てすと1" />
50
+
51
+ </Grid>
52
+
53
+ </DataGridTemplateColumn.Header>
54
+
55
+
56
+
57
+ <DataGridTemplateColumn.CellTemplate>
58
+
59
+ <DataTemplate>
60
+
61
+ <Grid>
62
+
63
+ <Grid.RowDefinitions>
64
+
65
+ <RowDefinition />
66
+
67
+ <RowDefinition />
68
+
69
+ </Grid.RowDefinitions>
70
+
71
+ <Label Grid.Row="0" Grid.RowSpan="2" Content="{Binding Test1}" />
72
+
73
+ </Grid>
74
+
75
+ </DataTemplate>
76
+
77
+ </DataGridTemplateColumn.CellTemplate>
78
+
79
+ </DataGridTemplateColumn>
80
+
81
+
82
+
83
+ <DataGridTemplateColumn>
84
+
85
+ <DataGridTemplateColumn.Header>
86
+
87
+ <DataGridColumnHeader>
88
+
89
+ <Grid>
90
+
91
+ <Grid.RowDefinitions>
92
+
93
+ <RowDefinition />
94
+
95
+ <RowDefinition />
96
+
97
+ </Grid.RowDefinitions>
98
+
99
+ <Label Grid.Row="0" Content="てすと2" />
100
+
101
+ <Label Grid.Row="1" Content="てすと3" />
102
+
103
+ </Grid>
104
+
105
+ </DataGridColumnHeader>
106
+
107
+ </DataGridTemplateColumn.Header>
108
+
109
+
110
+
111
+ <DataGridTemplateColumn.CellTemplate>
112
+
113
+ <DataTemplate>
114
+
115
+ <Grid>
116
+
117
+ <Grid.RowDefinitions>
118
+
119
+ <RowDefinition />
120
+
121
+ <RowDefinition />
122
+
123
+ </Grid.RowDefinitions>
124
+
125
+ <Label Grid.Row="0" Content="{Binding Test2}" />
126
+
127
+ <Label Grid.Row="1" Content="{Binding Test3}" />
128
+
129
+ </Grid>
130
+
131
+ </DataTemplate>
132
+
133
+ </DataGridTemplateColumn.CellTemplate>
134
+
135
+ </DataGridTemplateColumn>
136
+
137
+
138
+
139
+ <DataGridTemplateColumn>
140
+
141
+ <DataGridTemplateColumn.Header>
142
+
143
+ <Grid>
144
+
145
+ <Grid.RowDefinitions>
146
+
147
+ <RowDefinition />
148
+
149
+ <RowDefinition />
150
+
151
+ </Grid.RowDefinitions>
152
+
153
+ <Label Grid.Row="0" Grid.RowSpan="2" Content="コンボボックス" />
154
+
155
+ </Grid>
156
+
157
+ </DataGridTemplateColumn.Header>
158
+
159
+
160
+
161
+ <DataGridTemplateColumn.CellTemplate>
162
+
163
+ <DataTemplate>
164
+
165
+ <Grid>
166
+
167
+ <Grid.RowDefinitions>
168
+
169
+ <RowDefinition />
170
+
171
+ <RowDefinition />
172
+
173
+ </Grid.RowDefinitions>
174
+
175
+ <ComboBox Name="comboTest" />
176
+
177
+ </Grid>
178
+
179
+ </DataTemplate>
180
+
181
+ </DataGridTemplateColumn.CellTemplate>
182
+
183
+ </DataGridTemplateColumn>
184
+
185
+
186
+
187
+ </DataGrid.Columns>
188
+
189
+ </DataGrid>
190
+
191
+ </StackPanel>
192
+
193
+ </Window>
194
+
195
+
196
+
197
+ ```
198
+
199
+ ViewModelでDataGridのItemsSourceにどうやって設定すればいいのかが分かりません。