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

Alternate style by Group

4 Answers 163 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steve Kaser
Top achievements
Rank 1
Steve Kaser asked on 27 Mar 2010, 09:06 PM
I am trying to find a way to alternate the style of a report by group.  Similar to alternating the by line using conditional formatting "RowNumber()%2=1" but at the group level.  Any suggestions would be welcome.

Thanks - Steve

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 31 Mar 2010, 05:58 PM
Hi Steve Kaser,

This is possible to achieve and to illustrate it we would use our ProductCatalog demo report which has 3 groups.
We know that group does not participate in the visual items hierarchy. It is represented by their header and footer only. Looking at API reference for the Telerik.Reporting.Processing.GroupSection class it is logical to assume that Parent property should refer to the group itself i.e. the property path:
ReportItem.Parent of the SubCategory group header will return the reference to the SubCategory group. Looking again in the API reference we see that Telerik.Reporting.Processing.Group has Style property and we will use it for this purpose:
ReportItem.Parent.Style.BackgroundColor

To set this property I will use already created UserFunction in Product Catalog report – ColorFromName().
Enter the following in the group2(ProductSubCategory) binding property:

Property path: Parent.Style.BackgroundColor
Expression: =ColorFromName(Iif(RowNumber("group1")%2=1,"Red","Transparent"))

Note the short syntax for the property path.

Now run the report and you should have alternating groups.


Greetings,
Steve
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
E Pons
Top achievements
Rank 1
answered on 26 Apr 2011, 08:20 AM
Hi,

We're using Q1 2011 in a WPF application.  I've attempted to use the method suggested above to implement alternate group shading, but I get a "cannot access setter" error.  This makes sense when I look in the current API documentation, as there is no setter listed for Style.  Then, I tried using "Parent.StyleName" as the property path, but that produced a "binding path is not supported" error.  I'm not sure why because StyleName is listed as a property of ReportItemBase.  Can you please help?

Thanks much!
0
Steve
Telerik team
answered on 29 Apr 2011, 11:34 AM
Hello E Pons,

I've attached the modified report exactly by the suggestion from my previous post which works as expected.

Greetings,
Steve
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
E Pons
Top achievements
Rank 1
answered on 26 May 2011, 05:37 AM
Hi Steve,

Thanks so much for verifying this.  It now works for me as well, so there must have been a typo I missed.  My apologies!!

Cheers,
E
Tags
General Discussions
Asked by
Steve Kaser
Top achievements
Rank 1
Answers by
Steve
Telerik team
E Pons
Top achievements
Rank 1
Share this question
or