wpf listbox to gridview ViewModel

4 posts, 0 answers
  1. Michael
    Michael avatar
    105 posts
    Member since:
    Nov 2010

    Posted 09 May 2011 Link to this post

    I have the scenario where I have a listbox bound to a collection of viewmodels, from which I want to drag to a gridview, upon dropping they will be converted to a second ViewModel and added to the gridviews collection.

    I would like to perform these actions in the overall viewmodel itself... the docs state:

    Subscribe to the DropQuery and DropInfo events for gridview. You can do that in two ways. The first way is to subscribe in the XAML:

    but im afraid im not familiar/smart enough to know what I need to code to subscribe these events to a method or command on the viewmodels?

    In the meantime im coding it up with code behind, but I would really like to move these actions to the viewmodels

    any help greatly appreciated

    Michael
  2. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 09 May 2011 Link to this post

    Hi Michael,

    You might want to check this blogpost.
    Let us know if you have any further questions of issues.

    All the best,
    Tsvyatko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    105 posts
    Member since:
    Nov 2010

    Posted 09 May 2011 Link to this post

    Thank you...not sure why i couldnt get that when searching....

    I also note that with my current implementation, I can no longer have the ability to drag/group by columns as it causes baddness in the whole drag drop scenario!??

  5. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 10 May 2011 Link to this post

    Hello Michael,

     Since, GridViewCells uses same infrastructure of RadDragAndDopManager, adding handlers on the RadGridView itself might interfere with the normal grouping behavior. To ensure that this logic is executed correctly the following code needs to be added in each Drag/Drop handler:

    if (e.Options.Source is GridViewHeaderCell || e.Options.Source is GridViewGroupPanelCell)
    {
            return;
    }

    All the best,
    Tsvyatko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top