Editable ComboBoxColumn

Jan 8, 2009 at 12:48 PM

I need an editable ComboBoxColumn for my project.
Trying this:

<tk:DataGridComboBoxColumn Header="Type" Width="Auto" x:Name="cbCustType" SelectedItemBinding="{Binding Path=Typ}">
                    <Style TargetType="ComboBox">
                        <Setter Property="IsEditable" Value="True" />
                        <Setter Property="IsReadOnly" Value="False" />

This allows me to edit the combobox, the bound value will be updated, but if the cell is in non editing mode, there will be no text shown.
If i select one of the items from the combobox, they will be shown in non editing mode.

Has anyone a solution to that?


Jan 13, 2009 at 6:02 AM
Hi Klausf,

I'm using the code below. OK, it is not Xaml but you can convert.
Might be that helps.


// ComboBox Column
DataGridComboBoxColumn dataGridComboBoxColumn = new DataGridComboBoxColumn ();
dataGridComboBoxColumn.Header =
dataGridComboBoxColumn.MinWidth = 100;
dataGridComboBoxColumn.ItemsSource = arraylist
b =
new Binding ("field1");
b.Mode =
dataGridComboBoxColumn.SelectedItemBinding = b;
dg.Columns.Add (dataGridComboBoxColumn);
Jan 21, 2009 at 9:27 AM

I have exactly the same problem... did you find a solution??

Jan 21, 2009 at 2:14 PM

I did it with a DataGridTemplateColumn:

                    <ObjectDataProvider x:Key="TypeList"/>                   

<tk:DataGridTemplateColumn Header="TypeSelection" CanUserResize="False" Width="Auto">
                      <TextBlock Text="{Binding Path=Type}"/>
                      <ComboBox IsEditable="True" MaxWidth="120"
                              Text="{Binding Path=Type}" ItemsSource="{Binding Source={StaticResource TypeList}}" >

In the UserControl Code I set the 'TypeList':
ObjectDataProvider K = (ObjectDataProvider)FindResource("TypeList");
K.ObjectInstance = MyDynamicListOfTypes;