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

RadGrid Header Styling Issue

7 Answers 212 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Narayan Solanki
Top achievements
Rank 1
Narayan Solanki asked on 27 May 2010, 01:55 PM
Hi,

I am using "Edit UI elements" to style a RadGrid.
As soon as i change anything to do with Header part it breaks my application.

Error details
--------------------------
Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index

On following lines (pageName.Designer.cs) (As soon as i remove these lines, my code works fine.)
-----------------------------------------------------------------------------------------------------------------------------------
((Telerik.WinControls.UI.GridGroupHeaderItem)(this.radGridClinics.GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0))).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(49)))), ((int)(((byte)(168)))), ((int)(((byte)(101)))));
            ((Telerik.WinControls.UI.GridGroupHeaderItem)(this.radGridClinics.GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0))).HorizontalLineWidth = 0;
            ((Telerik.WinControls.UI.GridGroupHeaderItem)(this.radGridClinics.GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0))).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(247)))), ((int)(((byte)(240)))));
            ((Telerik.WinControls.UI.GridGroupHeaderItem)(this.radGridClinics.GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(1).GetChildAt(0))).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(49)))), ((int)(((byte)(168)))), ((int)(((byte)(101)))));
            ((Telerik.WinControls.UI.GridGroupHeaderItem)(this.radGridClinics.GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(0).GetChildAt(1).GetChildAt(0))).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(247)))), ((int)(((byte)(240)))));

Does anyone suggest what i am doing wrong here?

Thanks,
Narayan

7 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 28 May 2010, 02:50 PM
Hi Narayan Solanki, please find the answer to this question in your support ticket (ID 313916).

Sincerely yours,
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.
0
John Bagdanoff
Top achievements
Rank 1
answered on 23 Jun 2010, 01:37 AM
I'm having the same issue. Can you post the solution here, or do I need to also open a support ticket?

Thanks in advance!
John
0
Nikolay
Telerik team
answered on 23 Jun 2010, 05:25 AM
Hi John Bagdanoff,

Thank you for contacting us.

Here is the answer to the question as it is given in support ticket 313916:
Unlike the other controls RadGridView changes its element tree dynamically at runtime. This is because it uses UI virtualization for its rows and cells. Only rows that are currently visible have corresponding visual elements and upon scrolling they are reused. Because of this you can't edit grid rows by using the element hierarchy editor at design-time. You should use the Visual Style Builder or do the changes by code.

I hope this helps.

Sincerely yours,

Nikolay
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
0
Narayan Solanki
Top achievements
Rank 1
answered on 23 Jun 2010, 09:34 AM
A suggestion/request for Telerik developers, Can you please improve visual style editor so it can have all the default styles (i.e. Desert, Black etc) in-built to choose which we can copy it and make changes as required.

Hi John,

I tried to follow all the suggestions from Telerik developers but it did not worked for me so I adopted following procedure after lot of R&D.

For some of the components and RadForm, I used Themes Color Blending. It works if you are ready to compromise your design.
Code:

Theme

 

currentTheme = ThemeResolutionService.GetTheme("ControlDefault");

 

HslColor baseColor = HslColor.FromColor(Color.FromArgb(193, 216, 240));

currentTheme.AddColorBlend(baseColorParamName, baseColor);

currentTheme.ThemeProperties[baseColorParamName] =

 

HslColor.FromColor(Color.FromArgb(184, 226, 204));

 

 


For rest of the components, I copied sample theme (XML) files from Example Theme folder.
In my case the path is C:\Program Files (x86)\Telerik\RadControls for WinForms Q1 2010 SP1\Examples\Themes (You may have diffrent installation path.)

Further Steps...
1) Created seperate folder called "Resources/Theme" under my project.
2) Copied all required XML files (Example: ButtonDesert.xml, PanelBarDesert.xml etc...)
3) Renamed files as per my requirement.
4) Changed following lines within the theme XML files...
CURRENT CODE: <XmlTheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ThemeName="Desert">
NEW CODE: <XmlTheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ThemeName="MyThemeName">
5) Add RadThemeManager to your main form (In my case, i have added to main MDI form)
6) Rename it as required.
7) Using RadThemeManager embed all the XML files as resources
8) Add following lines to adopt it as global style OR assign the style to individual componenet as required.

ThemeResolutionService

 

.ApplicationThemeName = "MyThemeName"

 

 

9) Compile and test.

I hope this steps will help you resolve your queries.

P.S. It is a painful task to build a style for RadGrid. Unless anyone has easy steps. (Please do not suggest Style Builder... It just does not work for me.)

Kind Regards,
Narayan

0
Nikolay
Telerik team
answered on 30 Jun 2010, 01:24 PM
Hi Narayan Solanki,

Thank you for the question.

If I have understood your question correctly, you want to create a custom theme starting from a predefined one. This is easily achievable with Visual Style Builder Q1 2010 SP2. Just follow these steps:
1. Open VSB and from the main menu select File >> Export Built-in Themes.
2. Select a folder and save the predefined themes in it.
3. From the main menu choose File >> Open Package and select one of the packages that you have saved at step 2).
4. Edit the theme according to your style preferences.
5. Save the customized package and load it in your project as demonstrated here.

As to the process of styling RadGridView, this a complex control and since we wanted to allow you to achieve e deep level of customization, we exposed the respective hierarchy of elements and their properties. In case you have suggestions that will improve the user experience while styling RadGridView, please write back. We will consider your feedback in our further development.

Sincerely yours,
Nikolay
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
0
Narayan Solanki
Top achievements
Rank 1
answered on 30 Jun 2010, 01:34 PM
Hi Nikolay,

Thanks for your reply.
I am aware of these steps but can you explain, How can i export in-built Themes like Black, Telerik etc.?
For example, I wish to export Black theme and replace Black colour with something else. How can i do that?

Thanks,
Narayan Solanki

0
Nikolay
Telerik team
answered on 30 Jun 2010, 03:15 PM
Hello Narayan Solanki,

The Telerik theme is currently not available in our new Visual Style Builder. The Office2007Black theme is exported as a theme package and you can export it by following the steps from my previous response.
As to the process of modifying an existing theme, please refer to the following help article: http://www.telerik.com/help/winforms/styling_radribbonbar.html

Kind regards,
Nikolay
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
Narayan Solanki
Top achievements
Rank 1
Answers by
Jack
Telerik team
John Bagdanoff
Top achievements
Rank 1
Nikolay
Telerik team
Narayan Solanki
Top achievements
Rank 1
Share this question
or