Creating a Custom Panel in Silverlight

Silverlight allows StackPanel and WrapPanel to be used as items panels in a ItemsPanelTemplate, for controls like ListBox where a collection of items are shown.

Sometimes we need to create a custom panel where the out-of-box panels may not full-fill the need. I came across one such situation where I need to show the items layered over one another.

It’s a Windows Phone 7 Pizza application, where user can choose the toppings, which are shown on top of a Pizza as if its a real one.

Continue reading

Introduction to WP7 Databound Application

This tutorial is part of the WP7 Databound Application series.

Read Part II, Creating the Pizza App User Interface (Opens in a new window)

In this tutorial, We will see what a Windows Phone 7 databound application is and how to create one. Specifically, we will create a simple pizza ordering application using a Windows Phone 7 databound project.

What is a databound application?

A databound application generates an application in a Model/View/ViewModel (MVVM) style, with sample data exposed in ViewModel classes. It creates a master view and details view which were bound to respective view models.

Why should I use a databound application?

When you create a databound application, it creates the pages with properly hooked up navigation and basic data usage, this includes both design time and run time data. Which means, you can see how the page looks without the need to run the simulator.

All you have to do is focus on your application logic.

Continue reading

Silverlight Tip: RadioButton/CheckBox Binding ClickMode

No doubt that Binding in Silverlight is a powerful feature. There are few caveats when considering RadioButton or CheckBox like controls.
The following code snippet is a common scenario where a RadioButton or CheckBox can be used with data binding.

 <ItemsControl>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <RadioButton Content="{Binding ItemName}" IsChecked="{Binding IsSelected, Mode=TwoWay}"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
 </ItemsControl>

Continue reading

Silverlight Password Strength Checker – Part 1 of 3

Introduction

In this 3 part series, we are going to learn how to create a custom control, the parts and states of custom control and skinning. We will create a simple password strength checker, which will tell how strong your password is. In part 1, we will see how to create a fully usable custom control.

Overview

A Custom Control is same as any other User Control except the fact that it comes with the power of editable Styles and Templates. For more details, see Control Customization on MSDN.

You Will Learn
  • What is a Silverlight Class Library
  • How to create a Custom Control using a Class Library
  • How to create properties that can be accessed both from Xaml and code-behind

Before going further, let’s have a look at what we are going to create.

Continue reading