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.
Unfortunately, activation email could not send to your email. Please try again.

IsSynchronizedWithCurrentItem

Thread ID:

Created:

Updated:

Platform:

Replies:

119125 May 13,2015 12:20 AM May 14,2015 12:12 AM WPF 1
loading
Tags: SfDataGrid
yapwen
Asked On May 13, 2015 12:20 AM

Hi ,

Good Day .

How to get 'IsSynchronizedWithCurrentItem' in SfDataGrid ?

Thank you .

Regards,
Yap

Elavarasan M [Syncfusion]
Replied On May 14, 2015 12:12 AM

Hi yapwen,


Thank you for using Syncfusion products.


We analysed your query and currently we don’t have direct support for IsSynchronizedWithCurrentItem in SfDataGrid. You can achieve your requirement (to use IsSynchronizedCurrentItem) in sample level. We have prepared a sample by using IsSynchronizedCurrentItem in SfDataGrid. Please find the sample from the following location:
Sample: http://www.syncfusion.com/downloads/support/forum/119125/SfDataGridSample63424717.zip

In the above sample, we have loaded SfDataGrid and ComboBox with same itemssource. By using current changed event in view of the datagrid, selected item of a grid will be reflected in combobox. For this, you need to change the current item of the collection (which is bound to the SfDataGrid and ComboBox) by using MoveCurrentTo method in Collectionview as shown in the following code snippet:


Code Snippet:

this.datagrid.View.CurrentChanged += View_CurrentChanged;


void View_CurrentChanged(object sender, EventArgs e)

{

//while selecting item in a grid, setting current item of collection (which is bound to the SfDataGrid and ComboBox) as current item of sfdatagrid.

CollectionViewSource.GetDefaultView(this.datagrid.View.SourceCollection).MoveCurrentTo(this.datagrid.CurrentItem);

}



While selecting an item in combobox, it will be reflected in datagrid with the help of currentchanged event of the collection (which is bound to the datagrid and ComboBox) and current item of datagrid is set as the current item of the collection in the event as shown in the following code snippet:
Code snippet:

CollectionViewSource.GetDefaultView(this.datagrid.View.SourceCollection).CurrentChanged += MainWindow_CurrentChanged;


void MainWindow_CurrentChanged(object sender, EventArgs e)

{

//while selecting item in combobox, setting current item of sfdatagrid from the current item of collection.

if ((sender as ListCollectionView).CurrentItem != datagrid.CurrentItem)

datagrid.CurrentItem = (sender as ListCollectionView).CurrentItem;

}


Please refer the below UG link to know about CurrentItem in Sfdatagrid:


UG Link: http://help.syncfusion.com/ug/wpf/index.html#!Documents/selection1.htm

Please let us know if this solution helps you.
Thanks,
Elavarasan M


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.

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.

;