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

GridViewToggleRowDetailsColumn Toggle Button Binding

6 Answers 198 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 16 Jun 2011, 04:07 PM
Hello,

I am using GridViewRowDetails to display information regarding a row in a GridView.  I am using the GridViewToggleRowDetailsColumn to toggle the information off and on.  I am developing with the MVVM pattern and extensive databinding.  I want to be able to hide the plus sign on a per row basis using binding.  In addition I would like to be able to toggle the button in my ViewModel code as needed.  Do you have any suggestions on how this can be accomplished using MVVM and binding?

Thanks,

Jason

6 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 20 Jun 2011, 12:10 PM
Hello Jason,

The main point here is that GridViewToggleRowDetailsColumn does not inherit from GridViewBoundColumnBase, so that it has no exposed DataMemberBinding property. I would advise yout to design a custom column that mimics the GridViewToggleRowDetailsColumn's features and inherits from GridViewBoundColumnBase. I have prepared an example project that illustrates this approach. Please, refer to it and do not hesitate to contact us immediately if any further inquiries occur.

Kind regards,
Ivan Ivanov
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
Jason
Top achievements
Rank 1
answered on 20 Jun 2011, 04:40 PM
Great, I downloaded the project.  I added 2 buttons to the main view, one for collapse all and one for expand all.  I bound the buttons to a DelegateCommand which executes methods that iterate through the Club model and set the IsExpanded property appropriately.  The IsExpanded setter calls the OnPropertyChanged method to push the changes to the ui.  This works well and the UI is updated the way that I want.  So half of my problem is solved.  I am still looking for a way to hide the button entirely by binding a property from the Club object to a Visibility in the XAML.  Do you think that you can help out with that.

Thanks,

Jason
0
Ivan Ivanov
Telerik team
answered on 21 Jun 2011, 12:21 PM
Hi Jason,

I would advise you to expose an additional property that implements this functionality. The original GridViewToggleRowDetailsColumn has a ToggleButtonStyleProperty, but this type of column won't work properly in your case, since it doesn't inherit from GridViewBoundColumnBase.

Greetings,
Ivan Ivanov
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
Jason
Top achievements
Rank 1
answered on 21 Jun 2011, 12:30 PM
Hey Ivan,

I was hoping that you could extend your example project to show me how this could be done.  I tried various techniques and was unable to get the behaviour that I was looking for.

Thanks,

Jason
0
Ivan Ivanov
Telerik team
answered on 21 Jun 2011, 01:10 PM
Hi Jason,

I have added this feature to my project. Please, refer to it.

Kind regards,
Ivan Ivanov
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
Rob Ainscough
Top achievements
Rank 1
answered on 06 Dec 2012, 05:29 PM
I have the exact same need but using an Silverlight 5 project ... any chance you have a working code sample for SL5?

It does seem to me odd that the GridViewToggleRowDetailsColumn has an "IsVisible" property that apparently can't be bound like other columns ... it's a pretty common UI request to NOT show a details button when there are no details present.

I've posted in the SL forum asking about this, any help would be appreciated and it would be even better if support for IsVisible data binding were included in the SL RadControls.

Thanks, Rob.
Tags
GridView
Asked by
Jason
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Jason
Top achievements
Rank 1
Rob Ainscough
Top achievements
Rank 1
Share this question
or