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

Border style in StyleRule

1 Answer 92 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Agustín Gómez
Top achievements
Rank 1
Agustín Gómez asked on 21 Apr 2010, 06:48 PM
Hi,

Im createing a subclass of StyleRule to apply on all reports of my project and i want to set borderStyle bottom to solid,
the problem is that borderStyle is read only,  is there another way to set the border style in a generic way?

thanks.

1 Answer, 1 is accepted

Sort by
0
Chavdar
Telerik team
answered on 26 Apr 2010, 04:57 PM
Hi Agustín Gómez,

You can set directly the Style.BorderStyle.Bottom property to the desired value. Consider the following example:
public partial class Report2 : Telerik.Reporting.Report
{
    public Report2()
    {
        InitializeComponent();
 
        var myRule = new MyRule();
        this.StyleSheet.Add(myRule);
    }
}
 
public class MyRule : StyleRule
{
    public MyRule()
    {
        this.Selectors.Add(new TypeSelector(typeof(Telerik.Reporting.TextBox)));
        this.Style.BorderStyle.Bottom = BorderType.Dotted;
        this.Style.BorderWidth.Bottom = Unit.Point(5);
    }
}

Although your approach is a possible one, I would highly recommend to you to take a look at the Exporting and Reusing Style Sheet article for a more robust method.

Kind regards,
Chavdar
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
General Discussions
Asked by
Agustín Gómez
Top achievements
Rank 1
Answers by
Chavdar
Telerik team
Share this question
or