amrishdeokuleParticipantApril 26, 2016 at 8:14 pmPost count: 3
We are currently using Xceed DataGrid for our WPF client application. The data is displayed in ScheduleView format for users as rows/columns where user can create bunch of rows. Once the rows are created on the grid user can select a row and edit the contents of any column. The data that is binded to the grid is coming from SQL Server database which is common to all the users who are using this client application and Grid.
Our business requirement is, when a particular user has open this schedule grid on his screen, he see all the rows created by different users including his own rows. User should be able to edit his row/column value and at the same time all other rows on the screen inside the grid should be auto refreshed (may be after 1 min) to reflect the changes saved in DB by other users that too without restricting the user to edit his own row/column value and without locking the UI or losing the control/focus. User should be still allowed to continue his edit operation when auto refresh is happening for other changed rows…
Is it possible in Xceed datagrid (any version) to auto refresh (every after 1 min) all the rows except the one user is editing that too without locking the UI/Grid or losing focus?
Any help is appreciated…Fawzi [Xceed]MemberApril 27, 2016 at 7:10 pmPost count: 722
First, if your are using a DataGridCollectionView to wrap your source collection, and bind it to the DataGridControl.ItemsSource property, the grid will refresh without forcing the edited DataRow to stop the editing process. Moreover, unless you have an extremely large DataSource, it should be instantaneous, and the UI will not freeze.
Now depending on your scenario, you may not event need to refresh every minute or so. You could let the DataGridCollectionView handle the source changes live, without requiring a refresh of the whole source. It can update only items that were added or deleted, and depending on the actual source collection you are using, update existing items with new values. This way, all other items would not be changed.
Let’s say for instance that a user adds a new row, which is sent to the DB. In turn the DB sends an update to every source collection you have in your application. If these source collections are ObservableCollection, they will notify that an item was added. The DataGridCollectionView will get notified that this was the case, and it will simply update itself to reflect this. And in turn, it will notify the DataGrid a new item was added, and depending on its values, and sorting and grouping in the grid, will display the item if it happens to fall into view. But minimally it will adjust the scrollbar to reflect the item addition.
If you also need to notify the grid about exiting items that only have changed values, you have a few solutions. You can use a BindingList instead of an ObservableCollection as the data source collection. This will notify the collection was updated by property changes, and not only by adding or removing items. Or you can simply call refresh on the DataGridCollectionView when you judge it is needed (for instance every minute as you suggested). Or if you know which items have changed when you receive an update from the DB, you can call the ResetItem() method on the DataGridCollectionView, pass it the item that is being updated, and the new values will be reflected in the DataGrid.amrishdeokuleParticipantApril 27, 2016 at 8:22 pmPost count: 3
Thank you so much for your quick response on this. Great to know that we can achieve this as you mentioned. In order to understand it more clearly, is it possible for you to provide us any sample code so that we can create a prototype to see how this will help us in our case. Again, thank you for your help!
- You must be logged in to reply to this topic.