We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Selected items in master - detail datagrid

Thread ID:

Created:

Updated:

Platform:

Replies:

118073 Jan 28,2015 01:12 PM UTC Jan 30,2015 05:06 AM UTC WPF 3
loading
Tags: SfDataGrid
Emanuele Panzavolta
Asked On January 28, 2015 01:12 PM UTC

Hi,
 
I am trying to make a master - details datagrid, in which I monitor the selected rows in the details grid. By the way, I'm using SfDataGrid elements.
 
I can successfully track current selection in the master grid, by using the event
 

SfDataGrid.SelectionChanged

 
in the event handler, I check the content of the properties
 
 

SfDataGrid.SelectedItems

 

SfDataGrid.SelectionController.SelectedRows

 
 
Now, I tried to do the same with the details grid. I subscribed to SelectionChanged event. The event is fired, but the two properties listed above, always have empty content.
 
In SyncFusion online documentation, I found this information:
 
There are some limitations in Master-Details View.
...
- It does not have support to bind SelectedItem, CurrentItem.
...
 
Here it says that it is not possible to do a binding; but is it possible to deal with selected items in some way, also programmatically (in C# code)?
 
Thanks,
Emanuele
 

Farjana Parveen Ayubb [Syncfusion]
Replied On January 29, 2015 07:37 AM UTC

Hi Emanuele,

Thank you for contacting Syncfusion support.

We have analyzed your query. Please refer the following updates.

Query

Response

Getting SelectedItem in master details view by using SelectionChanged event.

You can achieve your requirement by using SelectionChanged event of details grid.

Please refer the code snippet and sample in the following location:

Code Snippet:

void FirstDetailsViewGrid_SelectionChanged(object sender, Syncfusion.UI.Xaml.Grid.GridSelectionChangedEventArgs e)

{

    var grid = (e.OriginalSender as DetailsViewDataGrid);

    var selectedrows = grid.SelectionController.SelectedRows;

    var selecteditems = grid.SelectedItems;

}

There are some limitations in Master-Details View.

...

- It does not have support to bind SelectedItem, CurrentItem.

...

 

Here it says that it is not possible to do a binding; but is it possible to deal with selected items in some way, also programmatically (in C# code)?

 

In details view grid you can’t able to bind the SelectedItem and CurrentItem. But, you can achieve this by using Behaviour and Dependency Property.

Please refer the code snippet and sample in the following location:

Code Snippet:

<local:SelectionBehaviour FirstDetailsViewSelectedItem="{Binding SelectedFirstNestedGridOrderDetails, Mode=TwoWay}"

                            FirstNestedSelectedItems="{Binding FirstNestedGridSelectedItems , Mode=TwoWay}"

                            FirstNestedCurrentItem="{Binding FirstNestedCurrentDetails,Mode=TwoWay}"/>

Sample Location: SfDataGrid_MasterDetailsView.zip

Regards,

Farjana Parveen A





Emanuele Panzavolta
Replied On January 29, 2015 06:44 PM UTC

Hi, many thanks for your help!
 
Regards,
Emanuele

Farjana Parveen Ayubb [Syncfusion]
Replied On January 30, 2015 05:06 AM UTC

Hi Emanuele,
 
Thank you for your update. Please let us know if you require further assistance on this.
 
Regards,
Farjana Parveen A



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;