0
私はSO Adding controls dynamically in wpf mvvmWPF MVVM - ViewModelにまず同じグループボックスにコントロールを追加
私のDataTemplateは次のようになります。これによると、私のMVVMパターンを作成しました:
<DataTemplate DataType="{x:Type Product_Configurator:ModelParametersViewModel}">
<GroupBox Grid.Row="1" x:Name="groupBox" Header="Standard" >
<Grid x:Name="grpStandard" >
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="{Binding AttributeName}" />
<TextBox Grid.Column="1" Style="{DynamicResource Configurator_Value_Box}" Text="{Binding EvalValue}"/>
</Grid>
</GroupBox>
</DataTemplate>
これが私の見解はどのように見えるかです:
実際、私はすべてのラベルとテキストボックスを同じグループボックスに入れたいと思います。これをどのように達成するのですか?
でModelParametersViewModelsは、単にあなたのDataTemplateからのGroupBoxを削除し、Product_ConfiguratorのコレクションとのItemsControlを置く:GroupBoxの中ModelParametersViewModels? – blindmeis
すごく、何とかそれは私にもあまりにも明白だったあまりにも、それを参照してください、ありがとう。私はそれをマークすることができるように答えとして投稿してください! – Ksdmg