Disable Child GridView refesh on main GridView refresh

2 posts, 0 answers
  1. Dean K.
    Dean K. avatar
    55 posts
    Member since:
    Aug 2011

    Posted 29 Aug 2014 Link to this post

    I have a GridView whose ItemsSource is bound to an ICollectionView. This GridView has a child GridView whose ItemsSource is bound to a property of currently selected item of the main GridView.

    This all works fine, however, when ever ICollectionView of the main GridView is refreshed the child GridView is also refreshed so it loses it current scroll position and item selection.

    Any ideas on how to prevent the child GridView from refreshing when main GridView ItemsSource is refreshed?
  2. Boris
    Admin
    Boris avatar
    276 posts

    Posted 02 Sep 2014 Link to this post

    Hello Dean,

    The described behavior is expected. When the ICollectionView is refreshed, the whole view is recreated. The GridView does not save any settings for the RowDetails, because there is no way to know with what they are filled with. 

    A possible way to keep the scroll position and the item selection, is to update only the individual item, and not refresh the whole ICollectionView.

    I attached an example of what I have in mind. In the sample project expand the first item and select one of its RowDetail items. Then press the button on the bottom to change the Name property of the parent row.


    Regards,
    Boris Penev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top