Creating User Controls

User controls enable you to build a user interface component that leverages one or more existing controls, combining them to form a single unit. Creating a user control is as simple as adding a new Silverlight User Control item to your project and adding controls to it using the XAML designer, designing it as you would a view. In fact, as you discovered back in Chapter 3, the MainPage class itself is a user control. Your user control then appears in the Toolbox, where you can drag and drop it into your views as required. You can write logic in the code-behind for the user control, and you can also define properties and events that can be used by the views that consume the user control.

Workshop: Creating a Simple User Control ...

Get Pro Business Applications with Silverlight 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.