Sunday, July 6, 2014

Canvas XAML Basics

The Canvas is the most basic layout panel in WPF. It's child elements are positioned by explicit coordinates.
It basically defines an area within which you can explicitly position child elements by using coordinates that are relative to the Canvas area.
It is more useful than a grid in some situations, such as when you have to position different elements at random positions, you do not have to calculate that at which
row and column of the grid you have to place the object.

Canvas Property used for Absolute Positioning are

Canvas.Top  - Gets or sets a value that represents the distance between the top of an element and the top of its parent Canvas.
Canvas.Left - Gets or sets a value that represents the distance between the left side of an element and the left side of its parent Canvas.
Canvas.Right  - Gets or sets a value that represents the distance between the right side of an element and the right side of its parent Canvas.
Canvas.Bottom  - Gets or sets a value that represents the distance between the top of an element and the top of its parent Canvas.



Application of a canvas in your project:

~ After creating a Windows Phone Silverlight 8.1 project in your Visual Studio 2013, Click on "Toolbar" in the extreme left of your screen.

~Either double click or drag the Canvas onto the XAML code.

~All those objects that you want to appear in the scope of the canvas are to be coded inside the Canvas opening and closing tags.




0 comments:

Post a Comment

Powered by Blogger.