“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

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

How do I get the height/width of a Silverlight UIElement if its not explicitly set?

The answer is, of course, to use the ActualHeight and ActualWidth properties. But wait, ActualHeight and ActualWidth return 0.0, what gives?  Well it turns out that if you just check the ActualHeight and ActualWidth right away, you are getting the measurements of the element BEFORE it has been measured and sized.  The way to accurately…

1

But wait… who is this guy?

I realized after writing the last post that I had neglected to say who I was and why I was writing about Silverlight development.  My name is Casey Stein and I’m a software developer working at Microsoft.  I’ve been using Silverlight on the job for the past few months and find that many times it…

0

“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…

0

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…

0