|
this.sfDataGrid.CellRenderers["ComboBox"] = new CustomComboBoxCellRenderer();
public class CustomComboBoxCellRenderer : GridComboBoxCellRenderer
{
SfComboBox comboBox = null;
protected override void OnInitializeEditElement(DataColumnBase column, RowColumnIndex rowColumnIndex, SfComboBox uiElement)
{
comboBox = uiElement;
uiElement.TextBox.TextChanged += UiElement_TextChanged;
base.OnInitializeEditElement(column, rowColumnIndex, uiElement);
}
private void UiElement_TextChanged(object sender, System.EventArgs e)
{
if (comboBox != null)
{
comboBox.DropDownListView.View.Filter = FilterItem;
comboBox.DropDownListView.View.RefreshFilter();
}
}
private bool FilterItem(object obj)
{
if (obj.ToString().ToLower().Contains(comboBox.TextBox.Text))
return true;
return false;
}
} |