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

How to set child selectors of DescendantSelector

3 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 16 Jan 2013, 08:37 AM
Hi I'm trying style selectors but having trouble to follow your guide in version Q3 2012. 
Here are the steps I have done:
1. Add a new stylerule in the StyleRule collection editor
2. Click on Selectors ellipse
3. Add a DescendantSelector
? - the newly added DescendantSelector does not have child selectors property, only a value. 
At this point I don't know how to add child selectors to it.

I would like to create a style rule so that every TextBox in the ReportHeader has blue, calibri font..

Thanks,
Roland

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 18 Jan 2013, 03:13 PM
Hi Roland,

Thank you for bringing this to our attention. We have verified the problem, logged it in our bug tracking system and it would be fixed for subsequent version of the product. For the time being you can add the desired DescendantSelector with code as shown in the Creating Style Rules help article. For your exact inquiry, in order to create a style rule so that every TextBox in the ReportHeader has blue, calibri font, use the following code in the Report constructor.

Telerik.Reporting.Drawing.StyleRule styleRule1 = new Telerik.Reporting.Drawing.StyleRule();
Telerik.Reporting.Drawing.DescendantSelector descendantSelector1 = new Telerik.Reporting.Drawing.DescendantSelector();
 
descendantSelector1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
            new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.ReportHeaderSection)),
            new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.TextBox))});
styleRule1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {descendantSelector1});
styleRule1.Style.Color = System.Drawing.Color.Blue;
styleRule1.Style.Font.Name = "Calibri";
this.StyleSheet.AddRange(new Telerik.Reporting.Drawing.StyleRule[] {styleRule1});

Your Telerik points have been updated as a token of gratitude for bringing this problem to our attention.

All the best,
Steve
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Ed
Top achievements
Rank 1
answered on 16 Jun 2014, 08:35 PM
As of Telerik Reporting 2014 SP1, the DescendantSelector is still broken in the Visual Studio designer. Does anybody know when it might be fixed?
0
Peter
Telerik team
answered on 19 Jun 2014, 12:17 PM
Hello Ed,

We have made some tests with our latest release Q2 2014 and we have successfully setup a descendant selector. Check out the screenshot. In our test we have added a Style Rule with Descendant Selector. The selector contains two members, in this case we used TypeSelectors (Panel and TextBox) This way the style will be applied to any TextBox located in a Panel.

Regards,
Peter
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Roland
Top achievements
Rank 1
Answers by
Steve
Telerik team
Ed
Top achievements
Rank 1
Peter
Telerik team
Share this question
or