Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1.         Dictionary<string, List<CheckBox>> checkboxes = new Dictionary<string, List<CheckBox>>();
  2.         public Options() {
  3.             InitializeComponent();
  4.  
  5.             checkboxes.Add("Ann", new List<CheckBox> {Ann, Annc});
  6.             checkboxes.Add("Aby", new List<CheckBox> {Aby, Abyc});
  7.             checkboxes.Add("Bam", new List<CheckBox> {Bam, Bamc});
  8.         }
  9.        
  10.         private void Switch(CheckBox sender, bool boolean) {
  11.             if (checkboxes.TryGetValue(sender.Name, out List<CheckBox> response)) {
  12.                 foreach (var checkBox in response) {
  13.                     checkBox.IsChecked = boolean;
  14.                 }
  15.             }
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement