Skip to content

Instantly share code, notes, and snippets.

@jpoehls
Created January 8, 2010 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpoehls/271809 to your computer and use it in GitHub Desktop.
Save jpoehls/271809 to your computer and use it in GitHub Desktop.
ResourceDictionary error in Silverlight
<UserControl x:Class="ResourceDictionaryHeadache.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<UserControl.Resources>
<ResourceDictionary Source="/SampleData.xaml" />
</UserControl.Resources>
<Grid x:Name="LayoutRoot">
<ListBox HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ItemsSource="{StaticResource SampleData}">
</ListBox>
</Grid>
</UserControl>
using System;
using System.Collections.ObjectModel;
namespace ResourceDictionaryHeadache
{
public class PersonList : ObservableCollection<Person> { }
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
}
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Headache="clr-namespace:ResourceDictionaryHeadache">
<Headache:PersonList x:Key="SampleData">
<Headache:Person Name="Joe" Age="20" />
<Headache:Person Name="Sam" Age="25" />
<Headache:Person Name="Dave" Age="30" />
</Headache:PersonList>
</ResourceDictionary>
@jpoehls
Copy link
Author

jpoehls commented Apr 7, 2010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment