我正在使用cinch framework v1。我暴露了一个公共财产(CurrentSuppier)并将该属性绑定到我的组合框的selecteditem ..更新后,组合框显示不会更改为供应商的当前值..下面是一些代码片段..
/// <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属性的当前值更新..但它不能在组合框上工作..
答案 0 :(得分:1)
SelectedItem和SelectedValue之间存在差异。
您是否尝试过使用SelectedValue?