WPF drags an item from the list and removes the text box

I am trying to drag an item from a list into a text box in WPF. I can not get the code that will allow me to do this.

thanks

+4
source share
1 answer

Use select change event in list

private void listBox2_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBoxItem i = (ListBoxItem)listBox2.Items[listBox2.SelectedIndex]; s = i.Content.ToString(); DragDrop.DoDragDrop(listBox2, i.Content.ToString(), DragDropEffects.All); } 
0
source

All Articles