Panorama Tricks – Using WrapPanel in wide PanoramaItems

The Silverlight for Windows Phone Toolkit also includes the WrapPanel from the Silverlight Tookit. It is ideal for displaying content in wide PanoramaItems. The sample application that ships with the Silverlight for Windows Phone Toolkit source includes an example of this. Since the subject has come up a few times, here’s how you do it:…

1

Control Lifecycle

What happens when you create a Control? When do overrides get called and events get raised? When do styles get applied? In response to this thread on silverlight.net, I’ve whipped this simple table up. There are some subtle differences between instantiating a control in XAML, and instantiating it via code that I’ve called out, but…

12

Silverlight Layout Fundamentals Part 2 – Layout Containers

In Layout Fundamentals Part 1, I started slowly, and demonstrated the need for a layout system. I touched on what it can do for you, and layout containers and properties. This post covers the layout containers and some layout concepts in a bit more detail. I will touch on some properties that affect layout; those…

3

Silverlight Layout Fundamentals Part 1 – What is Layout?

This is the first part of a series of articles on Silverlight 2’s layout system. I’m going to start off slowly, and demonstrate the need for a layout system, then explain some more about what "layout" actually is and what the Silverlight 2 layout system can do. Silverlight 1.0 did not have layout functionality. Silverlight…

3

Layout Transitions – An Animatable WrapPanel

  I’ve been playing around with RenderTransforms and decorators and such to make layout transitions, but for this WrapPanel, my goal was to introduce no additional UI elements, animations or transforms. I also wanted to use some easing equations to do some cool transitions, and separate that logic from the WrapPanel. I wanted the elements the be…

10

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