Musings
Public · Protected · Private
All objects added to an IDictionary must have a Key attribute or some other type of key associated with them.- WPF
-
2012-07-10 06:43To fix this compile error... just add a key Ex: x:Key="DummyKey" as below... <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib"> <sys:DateTime x:Key="DummyKey">10/30/2010 4:30 PM</sys:DateTime> </ResourceDictionary>
-
2012-07-10 08:04You can also add your own class objects as below.. public class Person { string FN { get; set; } string LN { get; set; } string MN { get; set; } } <Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:local="clr-namespace:WpfApplication4"> <Window.Resources> <ResourceDictionary> <local:Person x:Key="testobj" > </local:Person> </ResourceDictionary> </Window.Resources> <Grid> </Grid> </Window>
This blog is frozen. No new comments or edits allowed.