Book Image

Windows Phone 7 Silverlight Cookbook

By : Jonathan Marbutt, Robb Schiefer
Book Image

Windows Phone 7 Silverlight Cookbook

By: Jonathan Marbutt, Robb Schiefer

Overview of this book

Silverlight has revolutionized development using Microsoft technologies. It is an excellent tool for mobile application development. The XAML-based markup and familiar C# code are the perfect combination for building apps efficiently and with minimum hassle.Packed full of recipes containing comprehensive instructions for the tasks required to build modern compelling smartphone apps using Silverlight.Starting with application design and architecture, you will quickly move on to more technical features and APIs you can implement to make your app stand out. You will use the Camera API to scan barcode, location services to pinpoint the user’s GPS coordinates and accelerometer to provide feedback based on movement of the phone. All of these features can be provided in a slick user interface through the power of Silverlight. Animations, behaviors and XAML provide all you need and more.
Table of Contents (18 chapters)
Windows Phone 7 Silverlight Cookbook
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Element-to-element binding


While we have seen what happens when we bind to a ViewModel in order to get data, there is also the concept of having the ability to bind one control on a screen to another. One of the greatest and most overlooked features in Silverlight is element-to-element binding. This actually means that you can bind any property of any control to a property of another control. We will take a look at how to bind a few different controls to different properties of other controls.

Getting ready

In this example, we are going to stay in Blend the entire time, so let's create a new Windows Phone Application. On the Main Page, drag and drop both a textbox and a slider control. What we are going to do in this example is bind the value of the slider to the textblock.

We also want to go ahead and set the value of the SlideControl to 50 and the Maximum property to 100. This will make your slider control look 50 percent blue.

How to do it...

Now that we have the controls created, we need...