How to bind a (static) Dictionary to Labels?

后端 未结 4 1004
自闭症患者
自闭症患者 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:26

    I voted up Aaron for the converter and Tobias for indexers, but to actually access the static dictionary, try duplicating the property at the instance level and binding to that

    // Code
    class X 
    { 
        protected static Dictionary StaticDict { get { ... } } 
        public Dictionary InstanceDict { get { return StaticDict; } } 
    } 
    
    // Xaml
    Content="{Binding InstanceDict, Converter = ... } "
    

提交回复
热议问题