To reproduce:
public Form1()
{
InitializeComponent();
List<Item> items = new List<Item>();
for (int i = 0; i < 10; i++)
{
items.Add(new Item(i,"Item" + i,Color.Red));
}
this.radGridView1.DataSource = items;
this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
this.radGridView1.CellValidating += radGridView1_CellValidating;
}
private void radGridView1_CellValidating(object sender, Telerik.WinControls.UI.CellValidatingEventArgs e)
{
if (e.ActiveEditor != null && e.ActiveEditor is GridColorPickerEditor)
{
Color c = (Color)e.Value;
if (c == Color.Red)
{
e.Cancel = true;
Console.WriteLine("Red is not allowed!");
}
}
}
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
public Color Color { get; set; }
public Item(int id, string name, Color color)
{
this.Id = id;
this.Name = name;
this.Color = color;
}
}
Steps:
1. Activate the editor for the Color cell.
2. Leave the color as it
3. Press the Enter key. The CellValidating event is fired twice.
Note: it seems that when the color text is selected, the event is fired twice.