【问题标题】:Binding combobox column to a dictionary将组合框列绑定到字典
【发布时间】:2018-12-26 16:38:06
【问题描述】:

我正在尝试将组合框绑定到字典。 “阶段”是 ProjectPlans 类中的字典

 public Dictionary<decimal?, string> Phases { get; set; }

组合框不显示值,而是只显示单词“(集合)”,没有下拉箭头。我错过了什么?

<c1:C1DataGrid ItemsSource="{Binding ProjectPlans}" IsReadOnly="True" RowDetailsVisibilityMode="VisibleWhenSelected">

    <c1:C1DataGrid.Columns>
        <c1:DataGridBoundColumn Header="ID" Binding="{Binding ProjectId}" />
        <c1:DataGridComboBoxColumn Header="PHASE" Binding="{ Binding Phases}" DisplayMemberPath="Value" SelectedValuePath="Key"/>

【问题讨论】:

    标签: c# wpf combobox binding


    【解决方案1】:

    我找到了一种解决方法,改用 DataTemplateColumn。但我仍然不明白为什么它不适用于 DataComboBoxColumn。一个错误?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多