Rendering GridView seems to clear saved SelectedItems setting

6 posts, 0 answers
  1. Stephen
    Stephen avatar
    9 posts
    Member since:
    Sep 2010

    Posted 26 Jul Link to this post

    Hi, 

     

    I'm having persistent issues with the grid when I try to set a saved list of selected rows when loading data into the grid in my WPF project. 

    The basic logic is as follows:

    1. Load the ViewModel, get saved data and populate an observable collection for the ItemsSource property on the grid. 

    2. Set the SelectedItems property in the same procedure

    3. Explicitly call the property changed event for the selected items collection.

    I have implemented a custom behaviour to allow the RadGridView to use the Extended selection option and retain all selected items, and it works perfectly in this project and others, when setting the collection in the UI and binding to the collection in the ViewModel. 

    I put an OnCollectionChanged event onto my selected items collection, and while it gets called as expected when I set the items, it also seems to get called after the grid itself is rendered, which causes the saved selection to be lost. 

    If I use only a single item, i.e. SelectedItem, this does not get lost, and if I set SelectedItem by using the first line in the collection before setting SelectedItems collection itself, the UI retains the first one, but wipes the others. 

    I have tried a number of ways to work around this, including trying to fire an event after the selection is overridden but it's proving very tricky to get the right event, and anyway this behaviour should surely not be happening in the first place. 

    I am attaching a sample project which demonstrates a simpler version of this scenario, with the same problems. 

    Please advise.

  2. Stephen
    Stephen avatar
    9 posts
    Member since:
    Sep 2010

    Posted 26 Jul Link to this post

    I am struggling to attach the sample project. The web form keeps refusing my zipped solution file, which is roughly 50kb in size, so not sure why it's not working. 
  3. UI for WPF is Visual Studio 2017 Ready
  4. Stephen
    Stephen avatar
    9 posts
    Member since:
    Sep 2010

    Posted 28 Jul Link to this post

    any replies please?
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 29 Jul Link to this post

    Hi Stephen,

    The public forum system support only jpg, gif, png file extensions for the attachment. To send us the project you can use our support ticketing system, which provides 24 hours priority support and it also support up to 20MB archive attachments.
    As for the question itself, I tried to follow the steps that you provided, on my side, but I did not have any significant result. I believe that the sample project, which includes the custom selection behavior would help me fully understand the details.

    Regards,
    Ivan Ivanov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  6. Stephen
    Stephen avatar
    9 posts
    Member since:
    Sep 2010

    Posted 03 Aug in reply to Ivan Ivanov Link to this post

    Hi Ivan, 

     

    Thank you for your response. I don't see the option to create a new ticket anywhere. Could you point me in the right direction and I would happily do this? 

     

  7. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 04 Aug Link to this post

    Hello Stephen,

    You can open a new support ticket by navigating to the following page. Please let me know how this goes.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WPF is Visual Studio 2017 Ready