Get Item from current point

1 posts, 0 answers
  1. Mirko
    Mirko avatar
    9 posts
    Member since:
    Aug 2012

    Posted 28 Jun 2013 Link to this post


    I like to get the current item in a drag & drop operation.
    It´s shared code from silverlight and there it´s possible to get the current item with the following code:

    private System.Windows.Controls.ListBoxItem GetItemFromPoint(FrameworkElement listBox, Point CurrentPoint)
      var p = listBox.TransformToVisual(App.Center.RootVisual).Transform(CurrentPoint);
      IEnumerable hits = VisualTreeHelper.FindElementsInHostCoordinates(p, listBox);
      System.Windows.Controls.ListBoxItem item = null;
      foreach (UIElement element in hits)
        if (element is System.Windows.Controls.ListBoxItem)
          item = (System.Windows.Controls.ListBoxItem)element;
      return item;

    But now I´m using WPF and the RadListBox. The return type now is a RadListBoxItem and the parameter listBox is a RadListBox control.

    Which opportunities do I have with the RadListBox in WPF?

Back to Top