Unplanned
Last Updated: 21 Aug 2025 12:33 by ADMIN
Riziq
Created on: 21 Aug 2025 11:58
Category: GridView
Type: Bug Report
0
RadGridView: The Control can't Lose Focus When the CommandColumn Cell is Selected
When a CommandColumn cell is focused and we try to focus an external control, the RadGridView can't lose focus. The internal code will force the control to focus the CommandColumn cell again.
1 comment
ADMIN
Dinko | Tech Support Engineer
Posted on: 21 Aug 2025 12:33

Hi Riziq,

Thank you for reporting this. As a workaround, we can create a custom GridCommandCellElement and override the IsCurrent property. Then we can set the default IsCurrentProperty value, thus skipping the logic inside the GridCommandCellElement IsCurrent property setter.

public class MYCommandColumn : GridViewCommandColumn
{
    public MYCommandColumn(string fieldName) : base(fieldName)
    {
    }

    public override Type GetCellType(GridViewRowInfo row)
    {
        if (row is GridViewDataRowInfo)
        {
            return typeof(MyCommandCell);
        }
        return base.GetCellType(row);
    }
}

public class MyCommandCell : GridCommandCellElement
{
    public MyCommandCell(GridViewColumn column, GridRowElement row) : base(column, row)
    {
    }

    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(GridCommandCellElement);
        }
    }

    public override bool IsCompatible(GridViewColumn data, object context)
    {
        return data is MYCommandColumn && context is GridDataRowElement;
    }

    // Alternative implementation that bypasses GridCommandCellElement's IsCurrent setter
    public override bool IsCurrent
    {
        get
        {
            return (bool)this.GetValue(IsCurrentProperty);
        }
        set
        {
            this.SetValue(IsCurrentProperty, value);
        }
    }
}

Then we can add the custom column to the RadGridView and use it instead of the default GridViewCommandColumn.

MYCommandColumn myCommandColumn = new MYCommandColumn("Command");
this.radGridView1.MasterTemplate.Columns.Add(myCommandColumn);

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.