The Canvas is usually an underestimated layout control in Silverlight, instead it's really useful and flexible; one the most usefull things I have discovered while playing with Silverlight is to build pages using a Canvas as the most external container and place any other layout control inside it.

Why? it has a very nice and easy support for Z-Indexing and if you diplay some controls/forms/whatever on top of each other is a very simple task to realize. You can easily build a window-like desktop application in this way.

So here's the way in which I usually define my silverlight pages/applications.

<UserControl x:Class="ContextMenuExtender.Page" xmlns="" xmlns:x="" > <Canvas x:Name="surface"> <StackPanel x:Name="LayoutRoot" Background="White"> ... </StackPanel> </Canvas> </UserControl>

Technorati Tag: ,,

Related Content