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

Display Details Row via a ViewModel Property

6 Answers 49 Views
GridView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 26 Jan 2011, 05:06 PM
Is there any way of showing the details row by binding it to a property on a view model?

I would like to be able to have all row details collapsed but show and then hide the row details row for specific entries when they wish to display an alert message relating to the row above it.

Thanks,

John

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 27 Jan 2011, 01:12 PM
Hi John,

I am sending you a sample project illustrating a possible approach for binding your RowDetails to a property in your ViewModel. Let me know if you need further assistance.
 

All the best,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
John
Top achievements
Rank 1
answered on 03 Feb 2011, 12:01 PM
Hi thank you for the sample but it isn't really what I am trying to do.

Each row will have a details row (e.g. containing a button, or a textblock etc). 

By default these rows should be collapsed so that they are not loaded up into memory. When the state of the viewmodel changes (the viewmodel that is bound to the row) I want to be able to change the visibility of the details row so the user sees the button and/or message underneath the row it applies to.

At the moment this is achieved by making all the detail rows visible by default and controlling the visibility or height of the controls via the viewmodel. This means this is setup for every row which is a bit of a waste as this information may only need to be rendered for a handful of rows.

Ideally I could bind the visibility/existence of the details row per row via a property on the viewmodel.

Thanks,

John
0
Maya
Telerik team
answered on 08 Feb 2011, 05:31 PM
Hello John,

You may control the appearance of the RowDetails by using the RowDetailsVisibilityMode and set it to VisibleWhenSelected for example. Generally, the RowDetails will be loaded on demand once they are opened. Why do you want to bind them to a property instead of visualizing them when the corresponding item is selected? What is your ViewModel - isn't for the whole grid, not on a row-basis ?

 

Greetings,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Brian
Top achievements
Rank 1
answered on 17 Mar 2011, 08:24 PM
I am interested in the same thing...  only difference would be showing a collection of the row item.  So if the collection is null or empty, don't allow that row to be expanded into details view.

Thanks,
Brian
0
Maya
Telerik team
answered on 18 Mar 2011, 11:32 AM
Hello Brian,

May you take a look at this forum thread and let me know whether it corresponds to your requirements ?  

Best wishes,
Maya
the Telerik team
0
Brian
Top achievements
Rank 1
answered on 18 Mar 2011, 04:46 PM
yeah i found that i could do it in the selection changed event.  Just hide and show the rowdetails on the select condition.

Thanks,
Brian
Tags
GridView
Asked by
John
Top achievements
Rank 1
Answers by
Maya
Telerik team
John
Top achievements
Rank 1
Brian
Top achievements
Rank 1
Share this question
or