Position of UIElement
-
In Windows Forms, when I set the position of an UIElement I do it that way:
UIElement.Location = new Point(X, Y);
// then I get it with
UIElement.Location.X
UIElement.Location.YHow can I do this simple task in Silverlight, for example with canvas, called "MyCanvas";
// This doesn' t work.
MyCanvas.Margin.Left
MyCanvas.Margin.TopWhat is this Margin about?
-
In Windows Forms, when I set the position of an UIElement I do it that way:
UIElement.Location = new Point(X, Y);
// then I get it with
UIElement.Location.X
UIElement.Location.YHow can I do this simple task in Silverlight, for example with canvas, called "MyCanvas";
// This doesn' t work.
MyCanvas.Margin.Left
MyCanvas.Margin.TopWhat is this Margin about?
TCPMem wrote:
What is this Margin about?
From the docs: "The margin is the space between this object and other objects that will be adjacent when layout creates the UI." There's a variety of ways to layout elements in Silverlight/WPF beyond simple XY coordinates. There are elements that layout their child elements, and there are elements that layout based on their child elements. Maybe at least glossing over the documentation will help in understanding at least the basics of layout in Silverlight. There's Silverlight documentation available both online[^] and offline[^].
Mark Salsbery Microsoft MVP - Visual C++ :java: