0
votes

I created multiple texboxes with button click

private void Button_Click(object sender, RoutedEventArgs e) {

        i = i + 150;
        j = j + 250;
        TextBox x = new TextBox();
        x.Name = "new_textbox";
        x.TextWrapping = TextWrapping.Wrap;
        x.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
        x.AcceptsReturn = true;
        x.Width = 200;
        x.Height = 200;
        x.Margin = new Thickness(i, j, j, j);
        x.MouseMove += new MouseEventHandler(tboxMouseMove);
        can.Children.Add(x);
    }

private void tboxMouseMove(object sender, MouseEventArgs e) { TextBox tb = sender as TextBox; // here we have pass the textbox object so that we can use its all property on necessary DragDrop.DoDragDrop(tb, tb, DragDropEffects.Move); }

But not able to move this dynamic textbox using the above code. please correct the code to resize and move the textbox

1

1 Answers

0
votes

You will need a class for moving and resizing the control.

visit this link for further assistance.