Silverlight Panels: How to use Stack panel Layout in Silverlight - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Saturday, June 4, 2011

Silverlight Panels: How to use Stack panel Layout in Silverlight

In this article let us learn how to use Z-Index property in Canvas Layout panel in a Silverlight application. From my previous article we learnt how important canvas Layout panel is and how to use it. In this article we will learn one of the most important property of a Canvas Layout panel.

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