sev
sev
CC#
Created by FaNim on 3/3/2023 in #help
How to get and set position of an ui element via code wpf c#
// Create a new TextBox control TextBox textBox = new TextBox(); // Set the position of the TextBox Canvas.SetLeft(textBox, xPosition); Canvas.SetTop(textBox, yPosition); // Add the TextBox to a Canvas control Canvas canvas = new Canvas(); canvas.Children.Add(textBox); // Get the position of the TextBox double x = Canvas.GetLeft(textBox); double y = Canvas.GetTop(textBox);
13 replies