Static Resource Error-Collection of common programming errors
I am trying to work through a Silverlight example posted here:
http://www.silverlight.net/learn/quickstarts/choosing-which-control-to-use/
But, I am getting the following runtime error:
“Cannot find a Resource with the Name/Key WriterTemplate [Line: 14 Position: 42]”
Here is my code so far:
xaml
xaml.cs
using System; using System.Collections.ObjectModel; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace TreeView { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); ObservableCollection writers = new ObservableCollection() { new Writer("Chris Sells", new ObservableCollection() {"ComboBox", "ComboBoxItem"}, "Writer II"), new Writer("Luka Albrous", new ObservableCollection() {"ListBox","ListBoxItem"}, "Senior Writer"), new Writer("George Louverdis", new ObservableCollection() {"DataGrid","Binding"}, "Writer I")}; listBox1.DataContext = writers; dataGrid1.DataContext = writers; treeView1.DataContext = writers; } public class Writer { public Writer() { } public Writer(string writerName, ObservableCollection listOfTypes, string writerTitle) { Name = writerName; Types = listOfTypes; Title = writerTitle; } public string Name { get; set; } public ObservableCollection Types { get; set; } public string Title { get; set; } } } }