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

General Formatting Troubles with GridView

4 Answers 82 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 28 Jun 2009, 06:04 PM
Hello,

I'm having a lot of trouble getting my gridview to format appropriately, even though I've extensively looked through the knowledge-base and forums. I think the main cause of distress is the fact that changes make to my Theme in the Visual Style Builder are not reflected in the Preview or the Design view. This makes it hard to know what the grid will look like without running the project, which is time consuming. Is there any solution for this?

The main specific problem I am having is changing the formatting of the GridHeaderCellElements in my gridview. Using the Visual Style Builder doesn't seem to work at all (ala the tutorial) and when I do it programmatically, as in

        private void grdJobs_ViewCellFormatting(object sender, CellFormattingEventArgs e) 
        { 
            if (e.CellElement is GridHeaderCellElement) 
            { 
                e.CellElement.BackColor = Color.FromArgb(255, 255, 255); 
                e.CellElement.BackColor2 = Color.FromArgb(245, 245, 245); 
                e.CellElement.BackColor3 = Color.FromArgb(235, 235, 235); 
                e.CellElement.BackColor4 = Color.FromArgb(225, 225, 225); 
            } 
        } 

This prevents the nice blue highlighting when the cursor is moved over the cells. Any way I can keep the highlighting intact?

Please help,
Jeremy

4 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 02 Jul 2009, 12:58 PM
Hi Jeremy,

Visual Style Builder is the recommended way to change the style of Telerik WinForms controls, because changing styles through code is complex and error prone. Setting the back color in ViewCellFormatting event means that all existing states of the cell are disregarded (ViewCellFormatting has highest priority) and only the settings that have been made there are used -- this is why the mouse over state disappears.

I am afraid that our tutorial is outdated and will be updated as soon as possible. In order to see the change you have to select one of the two (IsMouseOver and IsSorted) states, to be more concrete, the third state from left to right and then make your modifications.

Regards,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jeremy Murtishaw
Top achievements
Rank 1
answered on 09 Jul 2009, 02:45 PM
Hello Victor,

This has solved that problem for the time being, but I'm curious to know how that particular state is meant to change the view of the element when neither of those two conditions are met.

Thanks!
Jeremy
0
Victor
Telerik team
answered on 13 Jul 2009, 08:46 AM
Hello Jeremy,

You can add another state which checks if neither condition is met and set the appropriate style.
Currently our state mechanism does not work very well and it is a matter of trial and error to get the right states so that they don't cancel or fight each other. We are currently planning to re-factor our theming logic and the Visual Style Builder application in order to address this and numerous other issues.

Best wishes,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Stefan
Telerik team
answered on 17 Mar 2011, 03:46 PM
Hello Jeremy,

I am glad to inform you that Q1 2011 is released and the VSB theme preview is greatly improved. Additionally, VSB has a functionality to start the newly introduced tool - ThemeViewer - which gives you the ability to preview the created theme of all RadControls for WinForms together. For more information refer to this blog post.

Kind regards,
Stefan
the Telerik team
Tags
GridView
Asked by
Jeremy Murtishaw
Top achievements
Rank 1
Answers by
Victor
Telerik team
Jeremy Murtishaw
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or