Column Header Style not applying in Silverlight 4

2 posts, 1 answers
  1. BENOIT CHEVALIER
    BENOIT CHEVALIER avatar
    22 posts
    Member since:
    Nov 2009

    Posted 28 Mar 2012 Link to this post

    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?
  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 28 Mar 2012 Link to this post

    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 >>
Back to Top