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

GridViewRow - Bind a property indicating every other row

2 Answers 28 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 24 Jan 2014, 11:13 AM
Hi,

I've got a RadGridView bound to an observable collection, I want to apply a DataTrigger style based on the IsAlternating value of the the row.
I've wired up the IsAlternating field to the grid (see xaml below) to see what value it is populating and it is always false.

 <telerik:GridViewDataColumn Header="Is Alternating"                                          
                                          DataMemberBinding="{Binding IsAlternating, RelativeSource={RelativeSource AncestorType={x:Type           telerik:GridViewRow}}}" Width="100"
                                                  HeaderTextAlignment="Center" TextAlignment="Center" />

So if I had 10 items in my collection, I would see 10 rows in my grid and the Is Alternating column display's false every time.
Am I misunderstanding what IsAlternating is used for?

I was under the impression that I would get something like (which is what I want)

Is Alternating
False
True
False
True
False
True
False
True
False
True

i.e. every other row would indicate if it is alternating or not.

Is there a  property that I can bind which will tell me if a row is alternating or not?

Thanks and regards,

Chris



2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 29 Jan 2014, 12:40 PM
Hello Chris,

I have tested the code you have shared together with setting alternation for RadGridView (though setting AlternationCount="2"). In my solution I got just what you expected to get. 

Please find attached my test solution. Would you please check it and let me know how is it different from yours?

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Dimitrina
Telerik team
answered on 30 Jan 2014, 09:58 AM
Hello,

It seems the demo was not attached properly, so I have added it again.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Christopher
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or