void layers_LayerSelectabilityChanged(object sender, LayerChangedEventArgs e) { foreach (var checkBox in LayersStack.Children.Cast <UIElement>() .OfType <CheckBox>() .Where(checkBox => Grid.GetColumn(checkBox) == 3 && checkBox.Tag.ToString() == e.LayerName)) { checkBox.IsChecked = layers.IsSelectable(layers[e.LayerName]); } }