HI,
I'm using D&D functionality from list view to text boxes,the problem is that when you drop the value from the list view
to the text box the cursor is stay in the last text box which you drop to it value and you cannot change the cursor
to other text box ,how can I avoid it and able to navigate between the text boxes.
The code for the text box events is as follows:
private void DropText_PreviewDrop(object sender, DragEventArgs e) { var textbox = (TextBox)sender; if (!(textbox.Text.Length > 0)) { var data = e.Data as DataObject; if (data != null) { var user = data.GetData(typeof(User)) as User; textbox.Tag = user; if (user != null) { string name = user.Name; textbox.Text += name; textbox.Focus(); textbox.CaretIndex = textbox.Text.Length; if (!_mapping.ContainsKey(textbox.Name)) _mapping.Add(textbox.Name, name); e.Handled = true; } } } else { e.Handled = true; } } private void DropText_PreviewMouseDown(object sender, MouseButtonEventArgs e) { var textBox = (TextBox)sender; if (textBox == null) return; var dataObject = new DataObject((textBox).Text); dataObject.SetData(DragSource, sender); DragDrop.DoDragDrop(textBox, dataObject, DragDropEffects.Copy | DragDropEffects.Move); }
Thanks ,
Miley