Binding cell background

3 posts, 0 answers
  1. Matt
    Matt avatar
    2 posts
    Member since:
    Aug 2012

    Posted 09 Aug 2012 Link to this post

    Hi,

    I'm using a CellStyle to bind the cell backgrounds to a property on the bound item.  The item exposes a color as a string and I'm using a converter to convert this into a SolidColorBrush.

    At runtime this seems to produce unhandled exceptions:

    WrappedException: Error HRESULT E_FAIL has been returned from a call to a COM component

    Stepping through the code it seems that the converter is working correctly, so this appears to be an issue with the grid.

    I did some searching and found this thread which has a sample application that shows how this can be done in WPF.  It's very similar to my approach.  Is there a different approach for Silverlight?

    I have a sample app but can't attach it.

    Cheers,
    Matt.
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 09 Aug 2012 Link to this post

    Hi Matt,

     

    The referenced project works and throws and exception, because most probably you are using Silverlight 4.
    In Silverlight  binding within style setters is supported  only in SL5 (SL4 not). 
    Why not try with CellStyleSelector instead? This approach works for both WPF/Silverlight.
    You may also check our live demos for further reference.   




    Regards,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Matt
    Matt avatar
    2 posts
    Member since:
    Aug 2012

    Posted 09 Aug 2012 Link to this post

    Thanks Vanya.  You're right - it is SL4.

    The CellStyleSelector is working well.

    Cheers!
Back to Top