- Custom controls is used to extend the functionality of existing controls and even create new controls with new functionalities.
- Creating custom controls is a great way to make Silverlight application more rich and unique
- Once a custom control is built we can reuse it anywhere in other applications too.
- Create a Silverlight Class Library Project in Visual Studio 2008.
- Because this will be a Control Library we've to add a reference to System.Windows.Controls assembly. This assembly will have 1.0.0.0 as version number for Silverlight 2.0 Beta1
- The next step we will add XmlnsDefinitionAttribute to our control Assembly
- Select the generic.xaml in the Solution Explorer and set the properties to get this file embedded in a format we need
- You've to delete the value of the Custom Tool property and set Build Action to "Resource".
- Write the coding in the Xaml file and the design the media button.
- To test this control we have to create a Silverlight Application Project. In Solution Explorer, right click the Solution's node and add a new Project to the Solution of type Silverlight Application.
- For Silverlight Application Visual Studio asks us about the testing method we like to use for this Silverlight Application. For now, a test HTML page will be fine for us.
- To use the control in our Test Application we've to add a reference to the Control Library Project.
- Open the page.xaml and write the caoe for calling the media button and run the application.
- Then a .dll file will be created. This file can be used to call the media button in other applications.
Friday, June 19, 2009
Developing a Custom Control for Silverlight 2.0
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment