【发布时间】:2012-02-04 06:14:48
【问题描述】:
我有一个静态字典
class X { static Dictionary<string,string> MyDict {get { ... }} }
此词典包含我想在网格控件中显示的数据:
<Grid>
<!-- Row and Column-Definitions here -->
<Label Grid.Row="0" Grid.Column="0" Content="{Binding MyDict.Key=="foo" }" ToolTip="foo" />
<!-- some more labels -->
</Grid>
1.) 我不知道如何(在 xaml 中)访问字典
2.) 我想将指定键的值绑定到标签的内容属性。
如何做到这一点?
【问题讨论】:
标签: c# wpf binding dictionary