It looks like this really isn't supported.
Here is how you can do this using a type converter:
public class DictionaryItemConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var dict = value as Dictionary<string, string>;
if (dict != null)
{
return dict[parameter as string];
}
throw new NotImplementedException();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
Then your binding should look like:
<Grid x:Name="LayoutRoot" Background="White">
<Grid.Resources>
<local:DictionaryItemConverter x:Name="DictConvert" />
</Grid.Resources>
<TextBlock Text="{Binding Converter={StaticResource DictConvert}, ConverterParameter=test}" />
</Grid>
And you can then pass a dictionary and it should work:
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("test","Testing 123");
dict.DataContext = data; I'll do a blog post on this to develop it further. But this should get you started.
-- bryant
Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.