Normal Properties vs. Dependency Properties

In the Silverlight development world there are two kinds of properties that you can have on a Silverlight control: normal C# properties and dependency properties.  The normal C# properties are added to a Silverlight control the same way as they would be added to any C# class: public string MyProperty { get; set; } And…


“The property ‘_UnknownContent’ does not exist…” What?

I was working on a custom Control the other day and that had its own XAML file.  I had it all coded up, but when I went to build it, it gave me the following two errors: Error    6    The property ‘_UnknownContent’ does not exist on the type ‘ResourceDictionary’ in the XML namespace ‘http://schemas.microsoft.com/winfx/2006/xaml/presentation’.    C:\Source\Controls\MyControl.xaml…

2

“Why didn’t you use a HyperlinkButton?”

The other day I was working on a Silverlight control that would display a taxonomy of categories.  Something along the lines of: One > Two > Three > Four > Five where “Five” is a child of the “Four” category, which, in turn, is a child of the “Three” category, and so on.  The way…


Styles Are Forever – But ControlTemplates Are a Developer’s Best Friend

I’ve been working on a project where I have a Button with a default Style that I wanted to change when the Button was clicked.  So let’s say you have a Button and a couple of Styles as shown below: <UserControl x:Class="SilverlightApplication1.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300"> <UserControl.Resources> <Style x:Key="RedStyle" TargetType="Button"> <Setter Property="FontFamily" Value="Verdana"/> <Setter Property="Foreground"…

1