Ok, I’ve given this talk a few times, and keep promising to post my slides and demo projects. ALLRIGHT, I’ll do it. If you saw the “pumpkin” version last fall, I’ve updated based on an attendees suggestion for spring. Now we throw bunnies, not pumpkins.
This session covers the following basic topics:
- Overview of controls
- Nesting content in Content controls
- Creating custom control templates
- Understanding Visual States
- Understanding Template Parts
- Creating custom User Controls
- Creating custom Controls
There is a starter project with some code snippets (in the snippets folder of the Silverlight project) that you can try to walk through on your own although I don’t have written explicit instructions to get you through the steps. The snippets may be enough to get you through them though if you are adventurous. There is also a completed version of the demo project that you can play with. Finally, I’ve included my slides.
If you have a user group in the So Cal area and would like me to come present this session for you (its about two hours of content) give me shout, and I’d love to come do it for you.
Silverlight Control Customization Slides and Demos (6MB)
In prepping demo’s for Expression Blend 4, I like to be able to start with a clean project “Most Recently Used” (MRU) list. In Expression blend, the list of recent projects is kept in an xml configuration file (user.config) in your user profile. I know this works in the Expression Blend 4 RC. I haven’t tried it on any other versions of Expression Blend.
For me, the path to my configuration file is:
Double clicking on it should open the file in Visual Studio 2010, although you can open it in the text editor of your choice.
If you look at the file, you will see a <ConfigurationService Version="0.1.0.0"> root node which contains a series of <ConfigurationObject Name="…"> elements. Each <ConfigurationObject> contains one or more <PrimitiveObject Name="…"> elements:
<PrimitiveObject Name="LastProjectCategoryTreeVisible" Type="…">…</PrimitiveObject>
Locate the <ConfigurationObject Name="ProjectManager"> element, and under that find the <PrimitiveObject Name="RecentProjects"> element. You will see a pipe (“|”) delimited list of project paths. You can delete the contents of the <PrimitiveObject Name="RecentProjects"> element, or just delete the entire element itself. Expression Blend will re-create it on the next time it starts up.
In addition to the <PrimitiveObject Name="RecentProjects"> element, I also deleted the <PrimitiveObject Name="LastNewProjectFolder"> element. Again, this is really just for demo purposes so that when I demo, the values look like they do after a clean installation. When you go to add a new project, the “Location” will default to a folder under your My Documents.