As usual, open visual studio and select Silverlight project. We can notice that there is a Grid layout in our MainPage.xaml. Remove the default Grid layout and just drag and drop the Canvas Layout into our application. The code for this looks like as
<Canvas Name="canvas1">
<Rectangle x:Name="rectangle1" Fill="Blue" Height="100" Width="100"/>
<Rectangle x:Name="rectangle2" Fill="red" Height="100" Width="100"/>
</Canvas>
From the above code we can notice that I placed two rectangles in our canvas layout. If we compile this without using Canvas.Left and Canvas.Right to both the rectangles, then we can able to see only second rectangle. This is because size of both the rectangles are same and we dint give absolute positions to our rectangles, so they both got overlapped each other.
Read more: Source
No comments:
Post a Comment