BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
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); } |
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