The Panel class is an important class in the development of Windows 8 store applications, and it plays a very important role in the Windows 8 store application layout system.
A panel can host multiple child elements, which can be stored in the stack, or in the grid, or at the edges of the handle elements.
The Panel class itself is an abstract class, and the following is the hierarchy of the Panel class:
The three standard layout controls included in the Windows 8 store application: Canvas (usually in a regular layout, try not to consider using Canvas, but in some special cases, Canvas is very handy), Grid (which is preferred for most general layouts), StackPanel (probably the simplest kind of panel type).
Canvas
To locate an element in canvas, you need to provide the horizontal and vertical coordinates relative to the upper-left corner.
Code implementation effect:
Where the left and top properties represent the relative position of the upper-and upper-left corner of the element and canvas.
Generally speaking, canvas is more suitable for the layout of elements in any location, so it is more suitable for vector graphics programming than control layout programming.
Similarly, we control the layout of control elements in canvas in C # code.
We note that the left and top properties of the button are not set in the XAML code, which is set through the C # code, as opposed to canvas.
The SetValue method is defined within the DependencyObject class, where Leftproperty and Topproperty are static fields of the canvas type in DependencyProperty.
The final implementation of the two layout settings is the same.