Im using the following code to drag from list box to text box , when I have one text box and I use the following code it prevent to drag item to text box that already filled with Item
privatevoid listbox_SelectionChanged(object sender,SelectionChangedEventArgs e){if((e.AddedItems.Count==1)&&(string.IsNullOrEmpty(textbox1.Text)))
but when I add new text box (textbox2) and try to check if it already filled ,the check is failed for all of the text boxes ,how can I avoid that?
private void listbox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if ((e.AddedItems.Count == 1) && (string.IsNullOrEmpty(textbox1.Text) || string.IsNullOrEmpty(textbox2.Text))) { if (ListBox.SelectedItems.Count > 0) { var mySelectedItem = ListBox.SelectedItem as User; if (mySelectedItem != null) { DragDrop.DoDragDrop(ListBox, mySelectedItem.ToString(), DragDropEffects.Copy); } } } }