Book Image

Instant Silverlight 5 Animation

By : Nick Polyak
Book Image

Instant Silverlight 5 Animation

By: Nick Polyak

Overview of this book

Silverlight is a Web technology that allows you to create both large business applications and little ads for your web page. Silverlight's main advantage is the ability to create rich UIs easily. In this book we will show how to build animations for different types of Silverlight applications in order to create great user experience."Instant Silverlight 5 Animation" is a practical guide to creating great user experiences in Silverlight. This book will clear Silverlight/WPF concepts needed for creating animations as well as practical examples of creating animations that will help you become an efficient developer for creating animations with Silverlight.This book provides a number of hands on examples of creating Silverlight animations in order to improve the user experience whether you are building a Silverlight Business application or a Silverlight banner ad. We also talk about ways to integrate Silverlight animations with business logic quickly and in the least invasive way. This book can be of help to both beginners and advanced developers. It starts talking about Silverlight concepts like dependency/attached properties and bindings. Then it goes into nitty-gritty detail of creating different animations for different application types. We explain how to animate custom controls, page navigation, how to imitate animation of random processes like fire or moving clouds. We talk about creating 3-D animations and building banner ads for your web page. Every concept, we describe in this book, is supported by small, detailed and easy to understand samples.
Table of Contents (16 chapters)

Bindings


Binding is a powerful Silverlight/WPF concept allowing two or more properties on two objects to be tied together, so that when one of them changes, the other changes as well. One of the binding's properties is called source property and the other target property. Usually we assume that the target property changes when the source does, but if the binding mode is two-way, the opposite is also true, that is, a change in the source property will be triggered by a change in the target property. The target property should always be a dependency property while the source property can be a usual .NET one. More on bindings can be found at http://tinyurl.com/wpfbindings.

The XAML code presented in the previous subsection uses binding to bind the RotationAngle dependency property of the SpinningControl object to the Angle property of the RotateTransform object:

<RotateTransform Angle="{Binding Path=RotationAngle, 
                                 Mode=OneWay,
                                 RelativeSource={RelativeSource 
                                                 Mode=TemplatedParent}}" />

In this case, the RotationAngle property of the SpinningControl object is the source property of the binding, while the Angle property of the RotateTransform object is its target property. The binding mode being set to OneWay specifies that the target property changes whenever the source property does, but not vice versa. The RelativeSource property of the binding, when set to TemplatedParent, specifies that the binding's source property is chosen by the Path property taken with respect to the control to which the template applies (in our case it is SpinningControl).