Adding button in column bound to datacontext

Oct 30, 2008 at 9:14 PM

Can you give me an example of how I would create and bind a DataGridComboColumn at runtime?  I am unsure of how to set the binding and also what field it maps to in the itemssource of the grid?  In Windows forms, I would have a DisplayMember, ValueMember, and then the field it is mapped to in the grid.  How does that work?

I am doing something like this but it doesnt work.

DataGridComboBoxColumn column = new DataGridComboBoxColumn();
column.SelectedItemBinding = new Binding("SampleID");
column.DisplayMemberPath = "SampleNumber";
column.SelectedValueBinding = new Binding("SampleID");
column.Header = (string)col.HeaderText;
IEnumerable<GeoStratSysDS.SampleRow> MySamples = from s in DataAccess.dtSample
  select s;

column.ItemsSource = MySamples;


Nov 2, 2008 at 3:03 PM
Does this post help at all,  It doesn't set it at runtime but it can give you an idea of which APIs to use when hooking up the DataGridComboBoxColumn.