C# ComboBox IsEnabled属性未更新
当多个属性(或组合在一起)导致false时,我试图禁用组合框中的项。第一次单击组合框时,将调用属性的getter并显示正确的状态。每次单击第一个组合框之后的组合框时,即使属性已更改,也不会再次选中属性(这意味着项目的启用/禁用状态应该不同) 以下是ComboBox项IsEnabled属性的代码:C# ComboBox IsEnabled属性未更新,c#,wpf,mvvm,combobox,isenabled,C#,Wpf,Mvvm,Combobox,Isenabled,当多个属性(或组合在一起)导致false时,我试图禁用组合框中的项。第一次单击组合框时,将调用属性的getter并显示正确的状态。每次单击第一个组合框之后的组合框时,即使属性已更改,也不会再次选中属性(这意味着项目的启用/禁用状态应该不同) 以下是ComboBox项IsEnabled属性的代码: <!--ItemContainer Style for disabling Combobox Item--> <ComboBox.ItemContainerStyle&
<!--ItemContainer Style for disabling Combobox Item-->
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="IsEnabled" >
<Setter.Value>
<MultiBinding Converter="{StaticResource orConverterKkey}">
<!--<Binding Source="{StaticResource vm}" Path="NotUseAngleRange" UpdateSourceTrigger="PropertyChanged"/>-->
<Binding Path="IsAxisEnabled" UpdateSourceTrigger="PropertyChanged"/>
<Binding Source="{StaticResource vm}" Path="IsFull180AngleRange" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</ComboBox.ItemContainerStyle>
您是否在模型中实现了Inotifypropertychanged..在道具更改时显示vm代码我用视图模型代码更新了问题,这显示了我在何处实现了Inotifypropertychanged。可能设置模式=双向?
public class ViewModelReferenceAxisType : ViewModelBase
{
public class ReferenceAxisTypeItem : ViewModelBase
{
...
}
}
public abstract class ViewModelBase : INotifyPropertyChanged, IDisposable
{
#region INotifyPropertyChanged Members
/// <summary>
/// Raised when a property on this object has a new value.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Raises this object's PropertyChanged event.
/// </summary>
/// <param name="propertyName">The property that has a new value.</param>
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
this.VerifyPropertyName(propertyName);
if (this.PropertyChanged != null)
{
var e = new PropertyChangedEventArgs(propertyName);
this.PropertyChanged(this, e);
}
}
#endregion // INotifyPropertyChanged Members