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

Column Header Style not applying in Silverlight 4

1 Answer 22 Views
GridView
This is a migrated thread and some comments may be shown as answers.
BENOIT CHEVALIER
Top achievements
Rank 1
BENOIT CHEVALIER asked on 28 Mar 2012, 11:31 AM
Hi,

I am hoping you can guide me in the right direction. I have a requirement whereby the color of the grid column header must match up with the color of the legend in a corresponding graph.

I have the following code which seems to do the trick, however, when a user running Silverlight 4 runtime (The app targets silverlight 4) sees the grid the colors are not displayed. Please see attached images.

var column = new GridViewDataColumn();
column.Header = graph.DisplayName;
column.DataMemberBinding = new Binding(graph.ValueBinding);
column.DataFormatString = "{0:#.##}";
 
// Bind Color of Foreground
var foregroundBinding = new Binding("Stroke");
foregroundBinding.Source = graph;
 
Style headerStyle = new Style(typeof(GridViewHeaderCell));
headerStyle.Setters.Add(new Setter(GridViewHeaderCell.ForegroundProperty, foregroundBinding));
column.HeaderCellStyle = headerStyle;
 
radGridView.Columns.Add(column);

Is there anyway I can achieve the required result on both versions of SIlverlight?

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 28 Mar 2012, 02:32 PM
Hi Benoit,

Generally, Silverlight 4 does not support bindings in Styles. You could try the approach illustrated in this article

Regards,
Maya
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
BENOIT CHEVALIER
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or