zoukankan      html  css  js  c++  java
  • Mvvm combobox绑定Dictionary问题

    常规绑定方式:

    ViewModel层:  public Dictionary<string, string>MathRelationCollection{ get; set; }//属性

    //赋值                          

    MathRelationCollection = new Dictionary<string, string>();
    MathRelationCollection = DynamicQueryHelper.GetMathCollection();

    UI 绑定:ItemsSource="{Binding LogicRelationCollecion}" DisplayMemberPath="{Binding Key, Mode=OneWay}" SelectedValuePath="{Binding Value, Mode=OneWay}"

    问题:前台Combobox显示为:[key,value]

    解决方法:ItemsSource="{Binding LogicRelationCollecion}" DisplayMemberPath=“Key" SelectedValuePath="Value"

    虽然解决了,但为什么会这样,还没想到,也欢迎大家多多提示

  • 相关阅读:
    Harbor安装 -- 企业级Registry仓库
    https原理
    第十节
    第九节
    第八节
    Spring中用到的部分设计模式
    代理模式及实现
    单例模式的实现
    索引
    第九章 集合
  • 原文地址:https://www.cnblogs.com/swarb/p/9924375.html
Copyright © 2011-2022 走看看