public void RemoveChoice(string choice) { Choices.Remove(choice); if (descriptions.ContainsKey(choice)) { descriptions.Remove(choice); } }
/// <summary> /// Remove choice from list /// </summary> /// <param name="chcToDelete"></param> public void DeleteChoice(Choice chcToDelete) { if (Choices != null) { // Remove by instance Choices.Remove(chcToDelete); } }
private void AddChoice(object obj) { if (!string.IsNullOrEmpty(ChoiceItem) && !Selected.Contains(ChoiceItem)) { Selected.Add(ChoiceItem); Selected = new ObservableCollection <string>(Selected.OrderBy(s => s)); Choices.Remove(ChoiceItem); } ToggleActivatation(); }
public async void ExecuteDeleteChoiceCommand() { var vs = (StringViewModel)Choices?.CurrentItem; if ((await DialogService.Ask("Delete Choice?", $"Delete choice \"{vs?.Value}?\"", AskButton.OKCancel)) == AskResult.OK) { Choices?.Remove(Choices.CurrentItem); _choicesChanged = true; OkCommand.RaiseCanExecuteChanged(); } }
public UIRadioButtonContainer() { OnChildAdded += (source, e) => { if (e.Target is UIRadioButton radio) { Choices.Add(radio); radio.OnValueChanged += SelectChange; } }; OnChildRemoved += (source, e) => { if (e.Target is UIRadioButton radio) { Choices.Remove(radio); } }; }
private void Configuration_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(Configuration.BrowserList)) { var added = Configuration.BrowserList.Where(b => Choices.All(c => c.Model.Name != b.Name)).ToList(); if (added.Count > 0) { foreach (var vm in added.Select(m => new BrowserViewModel(m, this))) { Choices.Add(vm); } } var removed = Choices.Where(c => Configuration.BrowserList.All(b => b.Name != c.Model.Name)).ToList(); if (removed.Count > 0) { foreach (var m in removed) { Choices.Remove(m); } } } }
public void OnPostRemoveChoice(String Value) { Choices.Remove(Value); }
public void RemoveChoice(Choice choice) { Choices.Remove(choice); }
public RadioEditorViewModel(IEditorViewModelFactory editorFactory) { _editorFactory = editorFactory; Title = "RadioButton Control"; AddChoiceCommand = new DelegateCommand(AddChoice, () => true); RemoveChoiceCommand = new DelegateCommand <ChoiceEditorViewModel>(choice => Choices.Remove(choice), choice => Choices.IndexOf(choice) > 0); Choices.CollectionChanged += (sender, args) => OnUpdateSnippet(); AddChoice(); }
public void RemoveChoice(Choice choice) { Choices.Remove(choice); OnChoicesUpdated(); }