Creating Custom Controls – A Common Starter Application

Follow up posted at bottom of article

It will be helpful as we explore custom controls to have a common starting project. You may  remember from my posting on the 12th that I laid out a structure with three projects in one solution, with 5 important files.

  1. In the ClassLibrary, customcontrol.cs  which defines the logic and methods as well as the attributes of the custom control. The attributes define the contract, and are what make the control skinnable with the assistance of tools like Blend
  2. Also in the ClassLibrary is a file that must be named generic.xaml that defines the default look for your custom control (in xaml).
  3. In your application there are three files (as usual) that do the heavy lifting: Page.xaml, Page.xaml.cs and App.xaml.  They do their normal jobs. That is: Page.xaml makes an instance of the control and may or may not include a Template statement asking for a Template in Page.xaml or (more likely) in App.xaml to override the default look and feel
  4. Page.xaml.cs contains the logic of the application (not of the control) just as it always does
  5. App.xaml may have a template for your new Custom control just as it may have a template for button or checkbox.

I’ve created a starter application with corresponding files and placed it here  The starter application just lays out the structure of the program and will be used for three inter-related purposes

1. An intensive tutorial (expected publication date approximately 10/13
2. A set of video I’ll be developing in the next week or two
3. Blog entries exploring what I hope will be interesting topics in depth

Following the suggestions received here, the tutorial should be pretty intensive, while the blog and videos will assume a more intermediate level of knowledge.  If this topic (templatable custom controls) is of interest, you’ll want to start by reviewing some or all of these:

Blog entries





Follow Link for Related Article

More Skinnable Custom Controls – Change to generic.xaml

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen Pluralsight & LinkedIn Learning courses. He was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP and a Microsoft MVP.
This entry was posted in z Silverlight Archives. Bookmark the permalink.