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

access DataColumn's bound DataMember value within CellTemplate/CellStyle

2 Answers 231 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thorsten
Top achievements
Rank 1
Thorsten asked on 04 May 2011, 01:01 PM
Hi,

I have a business object which contains a fixed size collection of pattern values which I need to display within a single gridviewrow.
So the gridviewcolumn definition in xaml looks like:

<rad:GridViewDataColumn DataMemberBinding="{Binding Path=DigitPatterns[0], Mode=OneWay}" />
<rad:GridViewDataColumn DataMemberBinding="{Binding Path=DigitPatterns[1], Mode=OneWay}" />
<rad:GridViewDataColumn DataMemberBinding="{Binding Path=DigitPatterns[2], Mode=OneWay}" />

So far everything works perfectly.
The problem is that I need to specify a custom cell style which depends on a single pattern and not the whole business object.
But DataContext within a cell style or template always refers to the business object, so I'm not able to access the bound pattern anymore.

Is there any way to access the value of the DataMemberBinding from within a cell style or template ?

Thanks in advance




2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 04 May 2011, 01:08 PM
Hello,

 You can use our style selectors to style cells conditionally - please refer to our demos for more info. Furthermore you can use GetValueForItem() method of GridViewBoundColumnBase to access specific column value for specific item - or GridViewCell Value property. 

All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Thorsten
Top achievements
Rank 1
answered on 04 May 2011, 01:52 PM
Hi,

thanks, that should work.

Tags
GridView
Asked by
Thorsten
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Thorsten
Top achievements
Rank 1
Share this question
or