Jenny, can you give an example? I have set combo box to dictionary and everything is working ok. When I'm in edit mode I get text instead ID value. I can select and change value. Value is writen in collection. But when cell is not being edited ID (integer) value is shown again. My data template:
<DataTemplate x:Key="pDataTemplate">
<TextBlock Text="{Binding}"
TextTrimming="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:Cell}}, Path=ParentColumn.TextTrimming}"
TextWrapping="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:Cell}}, Path=ParentColumn.TextWrapping}"/>
</DataTemplate>
and in code:
DataTemplate template = new DataTemplate();
FrameworkElementFactory factory = new FrameworkElementFactory(typeof(ComboBox));
factory.SetValue(ComboBox.ItemsSourceProperty, PList);
factory.SetValue(ComboBox.DisplayMemberPathProperty, "Value");
factory.SetValue(ComboBox.SelectedValuePathProperty, "Key");
CellEditorBindingExtension binding = new CellEditorBindingExtension();
factory.SetValue(ComboBox.SelectedValueProperty, binding);
template.VisualTree = factory;
Column column = this.Table.Columns["p_id_fk"];
CellEditor cellEditor = new CellEditor();
cellEditor.EditTemplate = template;
column.CellEditor = cellEditor;
column.CellContentTemplate = this.grid1.FindResource("pDataTemplate") as DataTemplate;
column.CellEditorDisplayConditions = CellEditorDisplayConditions.MouseOverCell;
How to set Text binding to get text description instead of ID? I try all sort of things (also with converter) but only in example above I managed to get at least column value (ID). If I set path to some value (ex. column name {Binding Path=p_id_fk} I get all blanks). I've looked at solidFoundation example but I have grid data source in observable collection. I believe I can't use DataTableDictionary class. Is there something like ObservableCollectionDictionary class?
Can you help me please?