ST
stanleyj
Syncfusion Team
February 17, 2006 01:22 PM UTC
Hi Don,
see if Style.DropDownStyle = GridDropDownStyle.AutoComplete helps. If the dropdown is to be dropped on changing values, then use this code to show the dropdown.
private void gridDataBoundGrid1_CurrentCellChanged(object sender, System.EventArgs e)
{
GridComboBoxCellRenderer renderer = this.gridDataBoundGrid1.CurrentCell.Renderer as GridComboBoxCellRenderer;
if(this.gridDataBoundGrid1.CurrentCell.Renderer.StyleInfo.CellType == "ComboBox")
{
this.gridDataBoundGrid1.CurrentCell.ShowDropDown();
}
}
The above idea is to scroll the value when editing. If your requirement is different and you need to locate the selected index programmatically, then see if this piece of information helps.
The ComboBox CellType uses the ListBox for the dropdown and button is derived from GridCellButton and ComboBox is not directly implemented. The ListBox can be handled through the ListBoxPart to the instance of theGridComboBoxCellRenderer.
this.gridDataBoundGrid1.Focus();
this.gridDataBoundGrid1.CurrentCell.MoveTo(3,2); // ComboBox cell
this.gridDataBoundGrid1.CurrentCell.ShowDropDown();
GridComboBoxCellRenderer renderer = this.gridDataBoundGrid1.CurrentCell.Renderer as GridComboBoxCellRenderer;
renderer.ListBoxPart.SelectedIndex = i; // to select programmatically
Best regards,
Stanley
MS
Maxim Software Systems
February 17, 2006 03:25 PM UTC
Thanks for the info. I managed to get the functionality I needed by grabbing the existing value of the cell and using my custom collection class to determine what the previous/next value should be, then setting that new value back into the cell. But hopefully what you''ve posted will help someone else in the future.