DataGridTemplateColumn textColumn = new DataGridTemplateColumn(); textColumn.Header = header; textColumn.Width = DataGridLength.Auto; DataTemplate dts = new DataTemplate(); FrameworkElementFactory fc = new FrameworkElementFactory(typeof(ComboBox)); // Binding b = new Binding("ComboxClass"); Binding b = new Binding(field); b.Mode = BindingMode.TwoWay; b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; fc.SetBinding(ComboBox.ItemsSourceProperty, b); // fc.SetValue(ComboBox.DisplayMemberPathProperty, "PriceTypeValue"); // fc.SetValue(ComboBox.SelectedValueProperty, "PriceTypeId"); fc.SetValue(ComboBox.DisplayMemberPathProperty, displayMemberPathProperty); fc.SetValue(ComboBox.SelectedValueProperty, selectedValueProperty); fc.SetValue(ComboBox.SelectedIndexProperty, 0); fc.SetValue(ComboBox.WidthProperty, 100.0); dts.VisualTree = (fc); textColumn.CellTemplate = dts; dgForData.Columns.Add(textColumn);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)