I wanted to create custom WPF datagrid control, which allows to have datagridcomboboxcolumn with multicolumn display on selection of combobox, how this can be 开发者_StackOverflow社区implemented. Please help
Thanks in advance Kartheesh.
I'm a little confused to exactly what your trying to ask, but possibly I think it's either of two things;
You want a multi-column display per column. For example you want two or more items per column displayed, e.g. two checkboxes, or textboxs, etc. The following code below displays two combox boxes binded to an object data provider
<dg:DataGridTemplateColumn >
<dg:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding item1}" />
<TextBlock Text="{Binding item2}" />
</StackPanel>
</DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
<dg:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{StaticResource mybiglist}"
SelectedValue="{Binding item1}"/>
<ComboBox ItemsSource="{StaticResource mysecondbiglist}"
SelectedValue="{Binding item2}"/>
</DataTemplate>
</dg:DataGridTemplateColumn.CellEditingTemplate>
</dg:DataGridTemplateColumn>
Alternatively perhaps you want one or more columns per combo box, then this should help;
Multi-Column ComboBox in WPF A Simple Multicolumn Combo Box in WPF
精彩评论