Home Forums WPF controls Xceed DataGrid for WPF DataGridControl und Drag Drop

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24507 |

    Hello,

    I have Problems to realize Drag Drop.
    I want to get the actual Cell with the Event “MouseMove”. The problem is that this event only get fired if i click in a cell. But that is uncomfortable and dosen’t work with drag drop.
    Has anyone an idea or an example?
    thanks for all requests.

    M. S.

    Imported from legacy forums. Posted by Marc (had 707 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi – I do a similar thing for drop (from outside the grid) which uses HitTest of the mouse point to determine which part of the grid the cursor is over. Code extract is:

    DependencyObject parentObject = InputHitTest(ptInputPoint) as DependencyObject;

    DataCell thisCell = null;
    DataRow thisDataRow = null;
    ColumnManagerCell thisColumnManagerCell = null;
    RowSelector thisRowSelectorCell = null;
    bool IsCellFound = false;
    while (parentObject != null && !IsCellFound)
    {
    if (parentObject.GetType() == typeof(DataCell))
    {
    thisCell = parentObject as DataCell;
    IsCellFound = true;
    continue;
    }
    else if (parentObject.GetType() == typeof(DataRow))
    {
    thisDataRow = parentObject as DataRow;
    IsCellFound = true;
    continue;
    }
    else if (parentObject.GetType() == typeof(ColumnManagerCell))
    {
    thisColumnManagerCell = parentObject as ColumnManagerCell;
    IsCellFound = true;
    continue;
    }
    else if (parentObject.GetType() == typeof(RowSelector))
    {
    thisRowSelectorCell = parentObject as RowSelector;
    IsCellFound = true;
    continue;
    }
    else if (parentObject.GetType() == typeof(TableViewScrollViewer))
    {
    //high enough up the tree so stop
    parentObject = null;
    continue;
    }

    DependencyObject nextObject = VisualTreeHelper.GetParent(parentObject);
    parentObject = nextObject;
    }

    Once you have found the appropriate part of the grid that the cursor is over, you can use either the DataCell or GetIndexFromContainer to determine the row and column if appropriate.

    Derek

    Imported from legacy forums. Posted by Derek (had 435 views)

    User (Old forums)
    Member
    Post count: 23064

    Actual detail was from http://forums.xceed.com/forums/ShowPost.aspx?PostID=7382

    Imported from legacy forums. Posted by Derek (had 356 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you very much. This Post was very Helpfull for me.

    Imported from legacy forums. Posted by Marc (had 3850 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.