Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to provide GridControl Master-Detail extension with MVVM capabilities

$
0
0

This example illustrates how to add MVVM capabilities to the Master-Detail functionality. In this example we have created the MasterDetailMVVMHelper class that introduces the ExpandedMasterRowsSource attached property. This property is intended to be attached to GridControl and allows controlling details' expanded state via a collection in a view model.

Here is a sample XAML that illustrates how to attach this property to GridControl and make it bound to the ExpandedItems collection:

[XAML]
<dxg:GridControlmy:MasterDetailMVVMHelper.ExpandedMasterRowsSource="{Binding ExpandedItems}"Name="gridControl1"ItemsSource="{Binding Data}">

 
Now, by adding a couple of data objects to the ExpandedItems collection, you can expand corresponding rows in GridControl:

[C#]
ExpandedItems.Add(Data[1]);ExpandedItems.Add(Data[10]);
[VB.NET]
ExpandedItems.Add(Data(1)) ExpandedItems.Add(Data(10))

An important note: The collection being bound to the ExpandedMasterRowsSource must be an implementation of the INotifyCollectionChanged interface, otherwise this functionality will not operate as expected.

Question Comments

Added By: Ipek Guven at: 6/26/2012 11:52:42 PM    

This solution is not working with the latest native Master-Detail feature in Vol 12.1. Can you upgrade the solution or provide a new one for the latest release?
Thanks in advance.
Ipek

Added By: James J Sullivan Sullivan at: 8/13/2012 6:26:49 PM    

Ipek, you might want to reference the Grid.Extensions dll as well.
http://www.devexpress.com/Support/Center/p/Q383850.aspx

Added By: Neeraj Thakur at: 1/31/2016 10:27:09 PM    

Is there any same example  for winforms
thanks Neeraj

Added By: Ivan (DevExpress Support) at: 1/31/2016 11:31:48 PM    

Hello Neeraj,

I have extracted your question to a separate ticket - How to obtain expanded rows when the Master-Detail functionality is used - and passed it to our WinForms team. That ticket is in our processing queue, and we will update it once we have any news.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>