Customizing a ToolTip

(Special thanks to Andre Michaud and Mike Russell who showed me how to do this.) ToolTips are quite useful for for displaying helpful information when the user hovers over a control. The way that ToolTips are usually used is by setting the ToolTipService.ToolTip property to some text. This will display the text in a rather…

13

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

Retemplating a Standard Control (Including VisualStateManager Stuff)

This example demonstrates how to give a Button new visuals and visual state by re-templating. It also includes what to do with all of the existing VisualStateManager stuff, but first it discusses various ways of modifying existing controls. There are a few different ways of modifying an existing Control, with varying degrees of depth and…

2

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

Using VS Snippets to Add DependencyProperties and Attached DependencyProperties

It can be a little tedious to type in everything that you need to define a DependencyProperty but you can use VS 2008’s snippets to make is easy. The snippets are designed to work with WPF, but they can be made to work with Silverlight with one small change. First, you need to insert the…

1

Using an Attached DependencyProperty to Implement Pixel Snapping as an Attached Behavior

In a previous post, I introduced the Snapper element, which is a UserControl subclass that snaps its Content to an integer pixel. Now I’ll show how to implement snapping as an attached behavior using a custom attached DependencyProperty. To use the Snapper element, you put it into your tree, and “wrap” the element that you want…

7

Navigation with Animated Transition Effects

One of the common things that developers want to do is to navigate between pages of their application. Once they have that, then they want to make the transitions look pretty. The attached project (see below) show how to do use a TransitionControl to do both. The TransitionControl is extensible, so you can even write your…

8

DiscreteSlider – Adding Functionality with a Simple Control Subclass

How do you prevent the Slider from returning “ugly” values, and get it to “snap” to only the values that you want, such as integers, or multiples of a certain step value such as 0.125? One way to do this is to override OnValueChanged, but it helps to understand how that mechanism works. Below is an example of subclassing Slider to add…

6