public void cleanUpSetLevel(GeneralMatcherVM newLevel) { foreach (GeneralMatcherVM matcherVM in MatcherVMs) { if (matcherVM != newLevel && matcherVM.IsLevel) { matcherVM.IsLevel = false; } } }
public SettingsMatcherVM(MatcherChain matcherChain) { this.matcherChain = matcherChain; MatcherVMs = new MyBindingList <GeneralMatcherVM>(); MatcherVMsRemoved = new MyBindingList <GeneralMatcherVM>(); Action <GeneralMatcherVM> removeFromUI = matcherVM => { MatcherVMs.Remove(matcherVM); MatcherVMsRemoved.Add(matcherVM); matcherVM.IsLevel = false; }; AddMatcher = new DelegateCommand(_ => { GeneralMatcherVM matcher = new GeneralMatcherVM(removeFromUI, cleanUpSetLevel); matcher.Name = "Matcher #" + (MatcherVMs.Count + 1); MatcherVMs.Add(matcher); }); }