2010-09-15 64 views
0

我正在使用cinch框架v1。我公開了一個公共屬性(CurrentSuppier),並將該屬性綁定到組合框的selecteditem中。更新後,組合框的顯示不會更改爲供應商的當前值..下面是一些代碼片段..WPF使用CINCH SelectedItem COMBOBOX

/// <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的當前值更新財產..但它不會在組合框上工作..

回答

1

SelectedItem和SelectedValue之間有區別。

您是否嘗試過使用SelectedValue?