public void InitializeUnselect() { if (Id == 0 || Id == 1 || Id == 7 || Id == 8) { // 禁选英雄选择,增加[未选择] ItemsInfos.Insert(0, new ComboBoxItemInfo { Id = "0", Name = L("NO_CHOOSE"), Acronym = "" }); } }
protected override void OnViewLoaded() { if (Id == 0 || Id == 1 || Id == 7 || Id == 8) { // 禁选英雄选择,增加[未选择] ItemsInfos.Insert(0, new ComboBoxItemInfo() { Id = "", Name = L("NO_CHOOSE"), Acronym = "", }); } base.OnViewLoaded(); }
public void Select(string name) { var selectedItem = ItemsInfos.FirstOrDefault(c => c.Name == name); if (selectedItem != null) { SelectedItemInfo = selectedItem; } else { ItemsInfos.Insert(0, new ComboBoxItemInfo { Id = "0", Name = name, Acronym = "" }); SelectedItemInfo = ItemsInfos[0]; } }