0

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

/// <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 属性的当前值进行更新 .. 但它不适用于组合框 ..

4

1 回答 1

1

SelectedItem 和 SelectedValue 是有区别的。

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

于 2011-05-09T06:35:04.443 回答