如何将Flag变量绑定到Xceed CheckComboBox

问题描述 投票:0回答:1

给出一个带有标志变量的对象:

[Flags]
public enum fCondition
    {   
        Scuffed = 1,       
        Torn = 2,
        Stained = 4
    }

   public class AnEntity  : TableEntity, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        // This method is called by the Set accessor of each property.  
        // The CallerMemberName attribute that is applied to the optional propertyName  
        // parameter causes the property name of the caller to be substituted as an argument.  
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        public int ConditionID { get; set; }
        public fCondition Condition
        {
            get => (fCondition)ConditionID;
            set {
                if (value != (fCondition)this.ConditionID)
                {
                    this.ConditionID = (int)value;
                    NotifyPropertyChanged();
                }
            }
        }
}

用于访问标志的ObjectDataProvider

<ObjectDataProvider x:Key="enmCondition" MethodName="GetValues" ObjectType="{x:Type core:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="enm:fCondition"></x:Type>
            </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>   

和Xceed CheckComboBox

<xctk:CheckComboBox  ItemsSource="{Binding Source={StaticResource enmCondition}}" />

在此阶段,它显示带有复选框的标志列表。我以为我需要:

SelectedItemsOverride="{Binding Path=Condition, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

我已经尝试过在我看来是所有其他逻辑组合(不要提及某些似乎也不合逻辑的组合,希望能有所帮助)。>>

给出一个带有标志变量的对象:[Flags] public枚举fCondition {Scuffed = 1,Torn = 2,Stained = 4} public class AnEntity:TableEntity,...

wpf data-binding xceed enum-flags
1个回答
0
投票

您应该如何将几个

© www.soinside.com 2019 - 2024. All rights reserved.