我想設置分類保存在組合框中的ObservableCollection,排序的ObservableCollection的WPF
我的結果,而不進行排序:
我的視圖模型:
private ObservableCollection<IdentificationSystemType> codeTypeEnum;
public IdentificationSystemType CodeType
{
get { return codeType; }
set { codeType = value;
OnPropertyChanged("CodeType");
}
}
public NewIdentificationSystemViewModel()
{
_identificationToAdd = new IdentificationSystem();
identificationDeviceToAdd = new IdentificationDevice();
_resetIdentificationCmd = new RelayCommand<string>(resetIdentification);
saveCommand = new RelayCommand<string>(addFunc, canSave);
codeTypeEnum = new ObservableCollection<IdentificationSystemType>(Enum.GetValues(typeof(IdentificationSystemType)).Cast<IdentificationSystemType>());
}
我曾嘗試與var ordered = codeTypeEnum.OrderBy(x => x);
但沒有..它是一樣的 我枚舉聲明:
public enum IdentificationTypes : int
{
TerminalEntryGate = 1,
TerminalExitGate = 2,
LoadingAreaEntryGate = 3,
LoadingAreaExitGate = 4,
IslandEntryGate = 5,
IslandExitGate = 6,
BayEntryGate = 7,
BayExitGate = 8,
ScalingAreaEntryGate = 9,
ScalingAreaExitGate = 10,
OfficeAreaEntryGate = 11,
OfficeAreaExitGate = 12,
TankFarmEntryGate = 13,
TankFarmExitGate = 14,
StagingAreaEntryGate = 15,
StagingAreaExitGate = 16,
LoadingBayIdentification = 21,
LoadingArmIdentification = 22,
LoadingIslandIdentification = 23,
PresetIdentification = 27
}
我該如何解決呢? 感謝,
你怎麼想它排序?按字母順序? – mjwills
是按訂單字母 – devtunis
你還沒有指定有序集合>>'VAR下令= displaySystemList.OrderBy(X => X);' –