Ok, I have a ResourceDictionary definition that I used for a WPF app below:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="fieldsPanel" TargetType="{x:Type StackPanel}">
<Style.Resources>
<Style TargetType="{x:Type CheckBox}">
<Setter Property="Margin" Value="8 2" />
</Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="0 2" />
<Setter Property="Width" Value="100" />
</Style>
</Style.Resources>
</Style>
This exact block of XAML, when brought into my Silverlight app, shows 4 errors in the error pane (the first error appears 3 times, the second once)
The tag 'Type' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml'
The property 'Resources' does not exist on the type 'Style' in the XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'
I can make all instances of the first error go away by replacing the "{x:Type TypeName}" text with "TypeName". But is this the correct way to fix this? Is this just another random and arbitrary difference between WPF and Silverlight?
But I can't figure out what I'm doing wrong in the second error. Can anyone give me some help (and the place you found the answer)?
EDIT:
If I knew how to Google "Style.Resources" (so that Google wouldn't ignore the dot) or if I knew the terminology for what that type of construct is called, I think could figure it out for myself.
EDIT:
It turns out that what I was trying to accomplish is probably best done with a UserControl. But apparently I need to learn a whole new set of rules for making UserControls in Silverlight.
In short, I want something like this:
<CheckBox Click="myClickHandler" Name="myName"/><TextBlock Text="The label for the checkbox" />
...made into a UserControl which I can instantiate several times with different names and labels. All checkboxes will use the same click handler.
If anyone wants to whip up some quick UserControl code and post it, I'd appreciate it. If not (and I totally understand not wanting to do free work for someone else), I'll start Googling.