private void UpdateRadioButtonGroup() { string groupName = GroupName; if (!string.IsNullOrEmpty(groupName)) { Visual rootScope = KeyboardNavigation.GetVisualRoot(this); if (_groupNameToElements == null) { _groupNameToElements = new Hashtable(1); } lock (_groupNameToElements) { // Get all elements bound to this key and remove this element ArrayList elements = (ArrayList)_groupNameToElements[groupName]; for (int i = 0; i < elements.Count;) { WeakReference weakReference = (WeakReference)elements[i]; RadioButton rb = weakReference.Target as RadioButton; if (rb == null) { // Remove dead instances elements.RemoveAt(i); } else { // Uncheck all checked RadioButtons different from the current one if (rb != this && (rb.IsChecked == true) && rootScope == KeyboardNavigation.GetVisualRoot(rb)) { rb.UncheckRadioButton(); } i++; } } } } else // Logical parent should be the group { DependencyObject parent = this.Parent; if (parent != null) { // Traverse logical children IEnumerable children = LogicalTreeHelper.GetChildren(parent); IEnumerator itor = children.GetEnumerator(); while (itor.MoveNext()) { RadioButton rb = itor.Current as RadioButton; if (rb != null && rb != this && string.IsNullOrEmpty(rb.GroupName) && (rb.IsChecked == true)) { rb.UncheckRadioButton(); } } } } }
// Token: 0x060054A4 RID: 21668 RVA: 0x00176F84 File Offset: 0x00175184 private void UpdateRadioButtonGroup() { string groupName = this.GroupName; if (!string.IsNullOrEmpty(groupName)) { Visual visualRoot = KeyboardNavigation.GetVisualRoot(this); if (RadioButton._groupNameToElements == null) { RadioButton._groupNameToElements = new Hashtable(1); } Hashtable groupNameToElements = RadioButton._groupNameToElements; lock (groupNameToElements) { ArrayList arrayList = (ArrayList)RadioButton._groupNameToElements[groupName]; int i = 0; while (i < arrayList.Count) { WeakReference weakReference = (WeakReference)arrayList[i]; RadioButton radioButton = weakReference.Target as RadioButton; if (radioButton == null) { arrayList.RemoveAt(i); } else { if (radioButton != this && radioButton.IsChecked == true && visualRoot == KeyboardNavigation.GetVisualRoot(radioButton)) { radioButton.UncheckRadioButton(); } i++; } } return; } } DependencyObject parent = base.Parent; if (parent != null) { IEnumerable children = LogicalTreeHelper.GetChildren(parent); foreach (object obj in children) { RadioButton radioButton2 = obj as RadioButton; if (radioButton2 != null && radioButton2 != this && string.IsNullOrEmpty(radioButton2.GroupName) && radioButton2.IsChecked == true) { radioButton2.UncheckRadioButton(); } } } }