This is a migrated thread and some comments may be shown as answers.

Checkbox column shifting

1 Answer 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeremy Murtishaw
Top achievements
Rank 1
Jeremy Murtishaw asked on 03 Mar 2010, 05:21 AM
Telerik,
I have a grid where the first column is a checkbox column.  When a checkbox is checked in any row for the first time, that checkbox shifts to the right within the column by a pixel or two.  Even if the checkbox itself isn't checked, but a mouseclick occurs within the cell, the same effect occurs.  I've experimented with multiple columns widths, thinking maybe I wasn't allowing enough room for the entire control, but nothing has worked.  Is this a known issue with a solution?

Thanks,
Jeremy

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 04 Mar 2010, 08:32 AM
Hi Jeremy Murtishaw,

Thank you for reporting this issue. I updated your Telerik points and we will address it in our upcoming release - Q1 2010. You should use a custom checkbox cell to work around the issue. Here is the code:

void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.CellType == typeof(GridCheckBoxCellElement))
    {
        e.CellType = typeof(CustomCheckBoxCellElement);
    }
}
 
public class CustomCheckBoxCellElement : GridCheckBoxCellElement
{
    public CustomCheckBoxCellElement(GridViewColumn column, GridRowElement row): base(column, row)
    {
    }
 
    protected override Type ThemeEffectiveType
    {
        get { return typeof(GridCheckBoxCellElement); }
    }
 
    protected override SizeF ArrangeOverride(SizeF finalSize)
    {
        if (this.Children.Count > 0)
        {
            RectangleF clientRect = GetClientRectangle(finalSize);
            float editorHeight = this.Children[0].DesiredSize.Height;
            this.Children[0].Arrange(new RectangleF(clientRect.X + 1,
              (finalSize.Height - editorHeight) / 2,
              clientRect.Width - 2,
              editorHeight));
        }
        return finalSize;
    }
}

Best wishes,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Jeremy Murtishaw
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or