Error in the output window (cropped to the most useful part):
Error: Cannot get 'Key' value (type 'String') from type 'System.Runtime.InteropServices.WindowsRuntime.CLRIKeyValuePairImpl`2 [[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, ....
Inside WinRT converts the type to:
System.Runtime.InteropServices.WindowsRuntime.CLRIKeyValuePairImpl<K, V>
If you add to your DataTemplate:
<TextBlock Text="{Binding}" Margin="5" />
You will see that he selected the above type with String, String .
However, for some reason, it is not being processed properly as expected. If you search for this type on the Internet, you will see that there was a documentary error for the problem in Connect.
A simple job should be to place your data in a simple object that is not KeyValuePair:
List<StringKeyValue> temp = new List<StringKeyValue>(); temp.Add(new StringKeyValue { Key = "key1", Value = "value1" } ); temp.Add(new StringKeyValue { Key = "key2", Value = "value2" }); temp.Add(new StringKeyValue { Key = "key3", Value = "value3" }); temp.Add(new StringKeyValue { Key = "key4", Value = "value4" }); this.DefaultViewModel["FooDictionary"] = temp; public class StringKeyValue { public string Key { get; set; } public string Value { get; set; } }
In any case, from a simple test, at least this is not the dictionary that causes the problem at all, it is the fact that the KeyValuePair object KeyValuePair that was converted to the CLRIKeyValuePairImpl type mentioned above. I tried to just use the list and add an instance of KeyValuePair<string, string> to the list, and that also failed.