top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Can you explain how Canvas layout actually works?

+1 vote
38 views
Can you explain how Canvas layout actually works?
posted Apr 27, 2015 by Karthi Kumar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer

Canvas is the simplest methodology for layout management. It supports absolute positioning using ‘X’ and ‘Y’ coordinates. ‘Canvas.Left’ helps to specify the X co-ordinate while ‘Canvas.Top’ helps to provide the ‘Y’ coordinates.

Below is a simple code snippet which shows how a rectangle object is positioned using ‘Canvas’ on co-ordinates (50,150).

<Canvas x:Name="MyCanvas">
<Rectangle Fill="Blue" Width="100" 
Height="100" 
Canvas.Left="50" 
Canvas.Top="150"/>
</Canvas> 

Below is how the display looks like. When you the run the code the XAML viewer will position the rectangle object on absolute ‘X” and ‘Y’ coordinates.

enter image description here

answer Apr 28, 2015 by Jdk
Similar Questions
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...