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

grid cell edit box

4 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chom
Top achievements
Rank 1
Chom asked on 29 Jan 2014, 01:05 AM
Hello,

How can I prevent the box from appearing in a grids cell when the cell is selected?

Thanks

Chom

4 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 31 Jan 2014, 02:04 PM
Hello Galvin,

Thank you for writing.

The "box" you are mentioning is the cell styling for the CurrentCell with the DesertTheme. If you want the cell to look like the other cells from the current row you should either more the styling for it from the theme, or you can use the CellFormatting event, to introduce the desired modifications. Here is how to do that:
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement.IsCurrent)
    {
        e.CellElement.BackColor = Color.Transparent;
        e.CellElement.BorderWidth = 0;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.BorderWidthProperty, ValueResetFlags.Local);
    }
}

I hope this helps.

PS. There was a duplicate thread of this one which was deleted. Note that you can add new posts to existing threads and it is not needed to open new thread for each post.

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Chom
Top achievements
Rank 1
answered on 10 Feb 2014, 04:38 PM
Hello Stefan,

Thank you for the reply. I implemented the above sample code and it did the trick. I have the option to change the themes in my application and was figuring on how to implement this change across all themes for the grid.

Thanks

Gavin
0
Chom
Top achievements
Rank 1
answered on 10 Feb 2014, 04:49 PM
My apologies. I would need to apply it to all the Telerik Themes. I have attached some images to show that I still get some cell lines when I change a theme.

Thanks for your help.

Gaivn
0
Stefan
Telerik team
answered on 11 Feb 2014, 07:15 AM
Hello Gaivn,

Thank you for writing back.

There are two options here:

1. You can add code in the CellFormatting event removing the undesired styling for each theme separately. You can use this tool to identify the styles you want to remove: http://www.telerik.com/help/winforms/tools-controlspy-overview.html.

2. You can edit the themes that you are using and just remove the current cell styling. Attached you can find a sample video demonstrating how to do this.

I hope this helps. 

Regards,
Stefan
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

Tags
GridView
Asked by
Chom
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Chom
Top achievements
Rank 1
Share this question
or