Hi all,
We are currently evaluating Xceed DataGrid for a project and have a requirement to have one ComboBoxEditor/Viewer cell in a DataGrid row filter another ComboBoxEditor/Viewer cell in the same row on item selection. i.e. user selects an item from the first cell combo drop down which then causes the second cell combo to update its items accordingly without a row leave. The test we came up with is rough and ready but works (other than the filtered combo cell updating to the first of the new items on filtering), but we wondered if there's a better solution that we've missed. We use a DataView and filter that using the Activate and Deactivate events of the ComboBoxEditor/Viewer. Here's what we came up with, can anyone se a better solution than this? Thanks in advance 
ComboBoxEditor masterComboBoxEditor, filteredComboBoxEditor;
DataView dataView;
DataTable filterEditorDataTable, filterViewerDataTable;
public TestForm()
{
InitializeComponent();
// Table for data grid
DataTable gridDataTable = new DataTable();
gridDataTable.Columns.Add("col1");
gridDataTable.Columns.Add("col2");
gridDataTable.Rows.Add(1, 1);
gridDataTable.Rows.Add(2, 3);
gridDataTable.Rows.Add(3, 5);
gridControl.DataSource = gridDataTable;
// Table for master combo
DataTable masterDataTable = new DataTable();
masterDataTable.Columns.Add("key1");
masterDataTable.Columns.Add("val1");
masterDataTable.Rows.Add(1, "a");
masterDataTable.Rows.Add(2, "b");
masterDataTable.Rows.Add(3, "c");
masterComboBoxEditor = new ComboBoxEditor(masterDataTable, string.Empty, "key1");
masterComboBoxEditor.TemplateControl.DisplayFormat = "%val1%";
masterComboBoxEditor.TemplateControl.Columns["key1"].Visible = false;
ComboBoxViewer masterComboBoxView = new ComboBoxViewer(masterDataTable, string.Empty, "key1", "%val1%");
gridControl.Columns["col1"].CellEditorManager = masterComboBoxEditor;
gridControl.Columns["col1"].CellViewerManager = masterComboBoxView;
masterComboBoxEditor.DeactivatingControl += new CellEditorEventHandler(masterComboBoxEditor_DeactivatingControl);
// Table for filtered combo
filterEditorDataTable = new DataTable();
filterEditorDataTable.Columns.Add("key2");
filterEditorDataTable.Columns.Add("fkey1");
filterEditorDataTable.Columns.Add("val2");
filterEditorDataTable.Rows.Add(1, 1, "X");
filterEditorDataTable.Rows.Add(2, 1, "Y");
filterEditorDataTable.Rows.Add(3, 2, "D");
filterEditorDataTable.Rows.Add(4, 2, "E");
filterEditorDataTable.Rows.Add(5, 3, "F");
// Use data view to control filtering in 2nd combo box
dataView = filterEditorDataTable.DefaultView;
filteredComboBoxEditor = new ComboBoxEditor(filterEditorDataTable, string.Empty, "key2");
filteredComboBoxEditor.TemplateControl.DisplayFormat = "%val2%";
filteredComboBoxEditor.TemplateControl.Columns["fkey1"].Visible = false;
filteredComboBoxEditor.TemplateControl.Columns["key2"].Visible = false;
gridControl.Columns["col2"].CellEditorManager = filteredComboBoxEditor;
filteredComboBoxEditor.ActivatingControl += new CellEditorEventHandler(filteredComboBoxEditor_ActivatingControl);
filteredComboBoxEditor.DeactivatingControl += new CellEditorEventHandler(filteredComboBoxEditor_DeactivatingControl);
filterViewerDataTable = new DataTable();
filterViewerDataTable.Columns.Add("key2");
filterViewerDataTable.Columns.Add("fkey1");
filterViewerDataTable.Columns.Add("val2");
filterViewerDataTable.Rows.Add(1, 1, "X");
filterViewerDataTable.Rows.Add(2, 1, "Y");
filterViewerDataTable.Rows.Add(3, 2, "D");
filterViewerDataTable.Rows.Add(4, 2, "E");
filterViewerDataTable.Rows.Add(5, 3, "F");
ComboBoxViewer filteredComboBoxViewer = new ComboBoxViewer(filterViewerDataTable, string.Empty, "key2", "%val2%");
gridControl.Columns["col2"].CellViewerManager = filteredComboBoxViewer;
}
void masterComboBoxEditor_DeactivatingControl(object sender, CellEditorEventArgs e)
{
// Set filter for filtered combo using selected key from master combo
dataView.RowFilter = string.Format("fkey1 = {0}", e.Cell.Value);
}
void filteredComboBoxEditor_ActivatingControl(object sender, CellEditorEventArgs e)
{
dataView.RowFilter = string.Format("fkey1 = {0}", ((XceedDataRow)gridControl.CurrentRow).Cells["col1"].Value);
}
void filteredComboBoxEditor_DeactivatingControl(object sender, CellEditorEventArgs e)
{
// Reset filter on leaving filtered combo
dataView.RowFilter = string.Empty;
}