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

Want to programmatically control whether row details are displayed for a given row

3 Answers 198 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 27 Dec 2011, 09:26 PM
I have a RadGridView control on a screen in my WPF application.  It holds the results of a search the user can perform.  There are two different types of objects that can be in this control; they both implement an interface that the window that holds the RadGridView is aware of.

One of these two types contains an array of a third type of object that I want to display in a Row Details data template, but only if the array isn't empty.  The other type does not have any information in it that I want to display in any row details area.

So I need a way to set the Row Details Visibility property for each row in the RadGridView based on its underlying type.  I've already added a boolean property called CanDisplayDetails.  For the type that  I don't want to display any details for, this always returns false.  Of the other type, this returns true if the number of rows in an array property is greater than zero. 

How do I hook this property up to each row's DisplayRowDetails property?

Tony

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 28 Dec 2011, 08:33 AM
Hello Tony,

 Please take a look at this forum thread on a similar topic.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Tony
Top achievements
Rank 1
answered on 28 Dec 2011, 09:03 PM
Didie:

Thank you for the link.  I've created a class called CustomGridViewToggleRowDetailsColumn and implemented the code from that thread.  However, I'm still not doing something right as I can't seem to make the Toggle Button disappear for those rows that I don't want it to display on.

I have a boolean property called CanDisplayDetails; when this is false, I don't want the toggle button to display.  I also have the following lines in my Xaml for the RadGridView control:

<cs:CustomGridViewToggleRowDetailsColumn IsEnabled="False"
                IsFilterable="False"
                IsGroupable="False"
                ToggleButtonVisibility="{Binding Path=CanDisplayDetails, Mode=OneWay}"/>
                        
However, the ToggleButtons still show for all rows, even thought it always returns false for a particular type.  What am I doing wrong?

Tony
0
Tony
Top achievements
Rank 1
answered on 29 Dec 2011, 07:50 PM
Never mind, I got the toggle button to hide properly.  I didn't realize that the ToggleButtonVisibility property was of type Visibility; I thought it was a bool for some reason.

Thanks anyway

Tony
Tags
GridView
Asked by
Tony
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Tony
Top achievements
Rank 1
Share this question
or