Layout Events – SizeChanged and LayoutUpdated

Executive Summary: Most of the time, SizeChanged is the right event to use, and LayoutUpdated is the wrong event.  The Silverlight 2 layout system offers two events: SizeChanged and LayoutUpdated. They look the same…here is how they are hooked up in C#: public Page() {     InitializeComponent();       LayoutRoot.SizeChanged += LayoutRoot_SizeChanged;     LayoutRoot.LayoutUpdated += LayoutRoot_LayoutUpdated;…

2

Pixel Snapping – the Snapper Element

What is pixel snapping? Snapping in general usually refers to allowing a property to take discrete as opposed to continuous values. In Silverlight, values such as Width, Height, Canvas.Left and Canvas.Top are of type double and not restricted to integer values, even though they refer to pixels. It is easy to consider how a 10…

2

Why I Don’t Like Canvas

In Silverlight 1.0, the only container element was Canvas. In Silverlight 2, there are a number of other layout containers, such as Grid, Border and StackPanel, and you can also make your own. Silverlight 2 applications can be completely layout-based and not rely on absolute positioning at all. Of course, you can still use Canvas. But should you?…

8