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

Styling a hosted UserControl

3 Answers 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jorge Delgado-Lopez
Top achievements
Rank 1
Jorge Delgado-Lopez asked on 08 Sep 2010, 01:15 PM
Hi.

I have a UserControl which contains many Telerik controls. I host this UserControl using RadHostItem which I populate on the CellFormatting event. How do I get the RadHostItem to apply the themes to its children?

- jorge

3 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 13 Sep 2010, 03:48 PM
Hi Jorge Delgado-Lopez,

Thank you for writing.

You can use ThemeResolutionService class and its static ApplyThemeToControlTree method:
UserControl1 uc = new UserControl1();
ThemeResolutionService.ApplyThemeToControlTree(uc, "myThemeName");
RadHostItem hostItem = new RadHostItem(uc);
e.CellElement.Children.Add(hostItem);

I hope this helps. Let me know if you have any other questions.

Sincerely yours,
Martin Vasilev
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
Aaron
Top achievements
Rank 1
answered on 02 Mar 2011, 08:01 PM
If I wanted to go about adding the theme from within the UserControl in which overridden function would I do so? I ask because it does not work when I set the theme name from within the UserControl's constructor or on the form's, which holds the usercontrol, load event. I have used:

ThemeResolutionService.LoadPackageFile()
ThemeResolutionService.LoadPackageResource()

ThemeResolutionService.ApplicationThemeName
Me.ThemeName
0
Martin Vasilev
Telerik team
answered on 08 Mar 2011, 11:06 AM
Hi Aaron,

I am afraid that I cannot understand very well your exact scenario and goal. Could you please open a new support ticket and send me a small sample project, which demonstrates your case? This will help me to investigate your particular scenario and provide you with accurate assistance.

Best wishes,
Martin Vasilev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Jorge Delgado-Lopez
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Aaron
Top achievements
Rank 1
Share this question
or