How to bind a (static) Dictionary to Labels?

后端 未结 4 1088
自闭症患者
自闭症患者 2021-01-19 05:57

I have a static Dictionary

class X { static Dictionary MyDict {get { ... }} }

This Dictionary contains Data i want to

4条回答
  •  庸人自扰
    2021-01-19 06:25

    Your binding will need to change to be the following:

    Content="{Binding Path=[foo], Source={x:Static local:X.MyDict}}"
    

    If you look at Binding Paths from the MSDN, you will see that string indexers can be specified in XAML. local will be the xmlns representing the namespace X resides in.

提交回复
热议问题