This is a migrated thread and some comments may be shown as answers.

Get Item from current point

0 Answers 150 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Mirko
Top achievements
Rank 1
Mirko asked on 28 Jun 2013, 07:27 AM
Hi,

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;
      break;
    }
  }
 
  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?

Thanks

No answers yet. Maybe you can help?

Tags
ListBox
Asked by
Mirko
Top achievements
Rank 1
Share this question
or