private void AlignmentEditor_Loaded(object sender, RoutedEventArgs e) { if (AlignmentControlHelper.GetLocalTargets(this) != null) { CheckTargetForCurrentAlignmentValues(); } }
private RadioButton GetActualRadioButton(HorizontalAlignment hAlignment, VerticalAlignment vAlignment) { List <RadioButton> localTargets = AlignmentControlHelper.GetLocalTargets(this); if (localTargets != null) { return(localTargets.FirstOrDefault(lt => GetEditorRole(lt) == alignmentAssociations[hAlignment, vAlignment].Key)); } else { return(null); } }
public void CheckTargetForCurrentAlignmentValues() { RadioButton actualTarget = GetActualRadioButton(HorizontalAlignmentValue, VerticalAlignmentValue); RadioButton checkedRB = null; if (AlignmentControlHelper.GetLocalTargets(this) != null) { checkedRB = AlignmentControlHelper.GetLocalTargets(this).FirstOrDefault(rb => rb.IsChecked.HasValue && rb.IsChecked.Value); } if (checkedRB != null && actualTarget != checkedRB) { checkedRB.IsChecked = false; } if (actualTarget != null) { actualTarget.IsChecked = true; } }