ラベルとコンボ ボックスを含むグリッドの自動生成を行うにはどうすればよいですか。私が望むのは、ユーザーがコンボボックス1でオプションを選択すると、メソッドが別のグリッド(コンボボックス2を含む)を自動生成することです。
以下は私が現在持っているコードで、現在のコンボボックスでIsSelectedが呼び出されたら、次のグリッドを表示するイベント駆動型メソッドを作成したいと思っています。
<Grid x:Name="comp1" Margin="0,84,230,345">
<Label Content="Test Component 1:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ComboBox x:Name="testCompCB1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,4,0,0"/>
</Grid>
<Grid x:Name="comp2" Margin="0,127,230,302" Visibility="Hidden">
<Label Content="Test Component 2:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ComboBox x:Name="testCompCB2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,4,0,0"/>
</Grid>
<Grid x:Name="comp3" Margin="0,166,230,262" Visibility="Hidden">
<Label Content="Test Component 3:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ComboBox x:Name="testCompCB3" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,5,0,0"/>
</Grid>
<Grid x:Name="comp4" Margin="0,205,230,222" Visibility="Hidden">
<Label Content="Test Component 4:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ComboBox x:Name="testCompCB4" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,6,0,0"/>
</Grid>
<Grid x:Name="comp5" Margin="0,245,230,182" Visibility="Hidden">
<Label Content="Test Component 5:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ComboBox x:Name="testCompCB5" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,6,0,0"/>
</Grid>
<Grid x:Name="comp6" Margin="0,281,230,145" Visibility="Hidden">
<Label Content="Test Component 6:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,3,0,0"/>
<ComboBox x:Name="testCompCB6" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,10,0,-3"/>
</Grid>
<Grid x:Name="comp7" Margin="0,328,230,100" Visibility="Hidden">
<Label Content="Test Component 7:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ComboBox x:Name="testCompCB7" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,5,0,0"/>
</Grid>
<Grid x:Name="comp8" Margin="0,370,230,59" Visibility="Hidden">
<Label Content="Test Component 8:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ComboBox x:Name="testCompCB8" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,3,0,0"/>
</Grid>
<Grid x:Name="comp9" Margin="0,406,230,15" Visibility="Hidden">
<Label Content="Test Component 9:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ComboBox x:Name="testCompCB9" HorizontalAlignment="Left" VerticalAlignment="Top" Width="207" IsEditable="True" Tag="Test Component" Margin="134,12,0,0"/>
</Grid>