No ParentGrid in e.Options.Source

6 posts, 0 answers
  1. Andrew
    Andrew avatar
    26 posts
    Member since:
    Apr 2009

    Posted 06 Apr 2009 Link to this post

    Hi,

    I am implementing an application where we have two RadGridViews, and we want to be able to drag and drop items between them

    It has been slightly difficult because their ItemsSource are bound to ObservableCollections with different data objects. I only want to transfer the common details across between these two collections, and the left over details ignored

    Both RadGridViews are droppable
    All rows (with exception of GridViewHeaderRow) are draggable & droppable

    Whenever I drag a GridViewRow on to the parent RadGridView, it causes an error

    So I would like to implement an if statement that checks if the dragged GridViewRow's parent is not equal to the destinations GridViewRow

    However when I drill down the e.Options.Source.Parent = {Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel} and not a RadGridView

    Going to the API, there is a Member under GridViewRow called "ParentGrid". However this doesn't appear when I go to e.Options.Source

    Can you please offer a suggestion on how to obtain the parent grid of the GridViewRow I am dragging?



  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 14 Apr 2009 Link to this post

    Hello Andrew,

    I am sorry for the delayed reply,

    Please download the latest SP release, this issues has been resolved there and the ParentGrid property should return the GridView.

    Best wishes,
    Miroslav
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Andrew
    Andrew avatar
    26 posts
    Member since:
    Apr 2009

    Posted 16 Apr 2009 Link to this post

    I am using the latest version (413) and I am still having the same problem. When dragging from a RadGridView into another RadGridView. At the "OnDropInfo" event:

    e.Options.Source = {Telerik.Windows.Controls.GridView.GridViewRow}
    e.Options.Source.Parent = {Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel}

    Expanding through these, I still can't find the ParentGrid

    Suggestions?


  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 21 Apr 2009 Link to this post

    Hi Andrew,

    The ParentGrid property is a property of the GridViewRow class, so you need to cast to it before using it:

    var sourceItem = e.Options.Source as GridViewRow;  
    var parentControl = sourceItem.ParentGrid; 

    The Parent property is a FrameworkElement property and is will point to the logical parent of the row, which is the panel.

    Hopefully this will work for you,

    Kind regards,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Nik
    Nik avatar
    14 posts
    Member since:
    Jan 2007

    Posted 28 May 2009 Link to this post

    Hi,

    I am not able to figure out.
    Can please provide me any code sample for the one RadGridView to other RadGridView drag and drop?
    if you can provide sample is VB, its would be great.

    Prompt reply really appreciated.

    Nik
  7. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 03 Jun 2009 Link to this post

    Hello Nik,

    Sorry for the delayed reply!

    The BugTracker example shows how to drag/drop to and from a grid view:

    http://blogs.telerik.com/miroslavpaskov/posts/09-05-15/silverlight_dragdrop_hello_real_world_application.aspx

    There the parent GridView is not referenced, but this can happen like so:

    Let's say that your drop destination item is the GridViewRow:

    'This is how you can get the parent GridView of the   
    'destination item:   
    Dim gridViewRow = TryCast(e.Options.Destination, GridViewRow)   
    Dim parentGridView = gridRow.ParentGrid  

    Hopefully this will work for you,

    Kind regards,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
DevCraft banner