In This Chapter
Creating a new control by grouping other controls
Creating custom controls
Creating and managing states for controls
Creating your own events
Adding behavior to controls
Silverlight comes with a wide array of controls. And if that weren't enough, you also have more controls available in the Silverlight Toolkit. But sometimes, you may have to create your own controls to accomplish something very specific, such as to display weather information that graphically displays the outlook for the day.
Or you may need to create a control that does something very simple, such as collect address information, but you may want to use the same data over and over again — for the delivery address, postal address, and so on.
Silverlight caters to both these needs. Controls that you create from scratch or by extending existing controls are called custom controls. Controls that group a bunch of other controls to form a new control are called user controls.
When you are writing any application, the application consists of some basic building blocks that you may want to use again and again. This building block may be some logic that exists as a piece of code (maybe in the form of a class or a method) or in the form of a user interface (which is the subject of discussion here).
For example, your application may contain a simple user interface that lets users of your Web site type in address information. You may be using ...