tags:

views:

157

answers:

1

Hi Experts,

I wanted to create custom WPF datagrid control, which allows to have datagridcomboboxcolumn with multicolumn display on selection of combobox, how this can be implemented. Please help

Thanks in advance Kartheesh.

A: 

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

wonea