Setting a style to GridViewRow works in SL5 but not in SL4

4 posts, 0 answers
  1. Kornelije
    Kornelije avatar
    28 posts
    Member since:
    May 2011

    Posted 17 Jul 2012 Link to this post

    I have a Silverlight 4 application, and the version of the GridView binary is 2012.1.215.1040.

    However, it seems that the GridView binary expects a Sliverlight 5 runtime.

    This code throws an exception (Arg_TargetInvocationException):

    <Style 
        x:Key="gridValueRowStyle"
        TargetType="telerik:GridViewRow">
        <Setter 
            Property="Background"
            Value="{Binding State, Converter={StaticResource stateToBrushConverter}}" />
    </Style>

    This exception is thrown only on computers with SL4 runtime. Note that the style doesn't have to be applied to GridView. Simply defining the style like this in Page resources is enough to throw an exception.

    Is this the bug or is this version of the GridView binary expected to work only with SL5?

    If the latter is true, where can I find the latest GridView version that would work on SL4 and where can I find the change log between that version and the version I currently have?

  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 17 Jul 2012 Link to this post

    Hello Kornelije,

     


    Bindings on style setters are supported in SL5, not in SL4. The mentioned control version (2012.1.215.1040 ) is built against Silverlight 4. Those for Silverlight 5 end with the extension 1050. You may download the latest version of our controls (Sl4/SL5) under Your Account. Following this link you may read more about the latest features and improvements for RadControls/Silverlight.   
    Thank you!


    Greetings,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Kornelije
    Kornelije avatar
    28 posts
    Member since:
    May 2011

    Posted 18 Jul 2012 Link to this post

    I see.

    I suppose it would be nice if the XAML parser would warn about that, but it's not important anymore.

    So if this does not work in SL4, that means that I am forced to use a StyleSelector and create a style for each possible value the property can have. Is that correct?

  4. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 18 Jul 2012 Link to this post

    Hello Kornelije,

     


    Yes you are right - the recommended approach to apply a style based on underlying property value is through using StyleSelectors. It works for both (SL4/SL5) - please check our online demos for further reference.   




    Regards,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top