How to set child selectors of DescendantSelector

4 posts, 0 answers
  1. Roland
    Roland avatar
    24 posts
    Member since:
    Aug 2012

    Posted 16 Jan 2013 Link to this post

    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..

  2. Steve
    Steve avatar
    10941 posts

    Posted 18 Jan 2013 Link to this post

    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,
    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!

  3. Ed
    Ed avatar
    9 posts
    Member since:
    Jun 2010

    Posted 16 Jun 2014 in reply to Steve Link to this post

    As of Telerik Reporting 2014 SP1, the DescendantSelector is still broken in the Visual Studio designer. Does anybody know when it might be fixed?
  4. Peter
    Peter avatar
    1631 posts

    Posted 19 Jun 2014 Link to this post

    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.


    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.

Back to Top