Designing a user control from scratch
If you want to design a reusable component that can be added to the artboard just like a system control, you can create a user control. User controls can contain other controls (including other user controls), resources, and animation timelines.
There are two ways to create a user control:
Add a new item of type UserControl to your project With this method, you start with an empty page. To design the appearance of your user control, you can draw everything on the artboard, using drawing tools and importing art and other assets.
Convert existing objects into a UserControl With this method, you can select multiple objects that are already on the artboard in another document, and convert them into a UserControl using the Make Into UserControl command. You can continue to modify your user control after conversion.
With user controls, you can create interactivity by defining a different visual appearance for each visual state that your user control can be in, and then adding behaviors or code to switch between those states based on user interaction. You can modify the transition between state combinations, even creating animation that will run when a state is first entered.
Tipp |
---|
The startup document of a Microsoft Silverlight project is considered a user control. This makes it possible to use states to create the interactivity of a Silverlight application. |
In this section
Siehe auch
Aufgaben
Draw a control in your project