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

Binding cell background

2 Answers 56 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 09 Aug 2012, 10:56 AM
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 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 09 Aug 2012, 11:06 AM
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.

0
Matt
Top achievements
Rank 1
answered on 10 Aug 2012, 01:44 AM
Thanks Vanya.  You're right - it is SL4.

The CellStyleSelector is working well.

Cheers!
Tags
GridView
Asked by
Matt
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Matt
Top achievements
Rank 1
Share this question
or