【问题标题】:WPF using CINCH SelectedItem COMBOBOXWPF 使用 CINCH SelectedItem COMBOBOX
【发布时间】:2010-09-15 04:34:16
【问题描述】:

我正在使用 cinch 框架 v1。我已经公开了一个公共属性( CurrentSuppier )并将该属性绑定到我的组合框的选定项.. 更新后,组合框显示不会更改为供应商的当前值.. 下面是一些代码 sn-ps ..

/// <summary>
    /// Current Supplier Record
    /// </summary>
    static PropertyChangedEventArgs currentsupplierChangeArgs =
        ObservableHelper.CreateArgs<IncomingViewModel>(x => x.CurrentSupplier);

    public SupplierModel  CurrentSupplier
    {
        get { return currentsupplier ; }
        set
        {
            currentsupplier = value;

            NotifyPropertyChanged(currentsupplierChangeArgs);

        }
    }

XAML 代码:

  <ComboBox Margin="345,8,542,0" Name="cbosupplier" Height="23" VerticalAlignment="Top" 
          VerticalContentAlignment="Center"
          ItemTemplate="{StaticResource SupplierTemplate}" 
          ItemsSource="{Binding Path=ListofSupplier}"     
          Grid.ColumnSpan="3" Grid.RowSpan="2"
          SelectedItem="{Binding Path=CurrentSupplier ,Mode = TwoWay}"  

我尝试将 CurrentSupplier 绑定到 TextBox 只是为了查看绑定是否有效 .. 确实有效 .. 文本框会使用我的 CurrentSupplier 属性的当前值进行更新 .. 但它不会在组合框上工作 ..

【问题讨论】:

    标签: wpf cinch


    【解决方案1】:

    SelectedItem 和 SelectedValue 是有区别的。

    您是否尝试过使用 SelectedValue 代替?

    【讨论】:

      猜你喜欢
      • 2011-01-10
      • 2012-06-19
      • 2011-11-01
      • 2017-02-20
      • 2014-03-18
      • 2015-06-28
      • 2010-10-24
      • 2023-03-09
      • 1970-01-01
      相关资源
      最近更新 更多