private void OnRadioButtonPropertyChanged(object sender, PropertyChangedEventArgs e) { bool updateLayout = false; bool updatePaint = false; switch (e.PropertyName) { case "Visible": updateLayout = true; break; case "TextLine1": updateLayout = true; _viewLargeText1.MakeDirty(); _viewMediumSmallText1.MakeDirty(); break; case "TextLine2": updateLayout = true; _viewLargeText2.MakeDirty(); _viewMediumSmallText2.MakeDirty(); break; case "Checked": UpdateCheckedState(); updatePaint = true; break; case "Enabled": UpdateEnabledState(); updatePaint = true; break; case "ItemSizeMinimum": case "ItemSizeMaximum": case "ItemSizeCurrent": UpdateItemSizeState(); updateLayout = true; break; } if (updateLayout) { // If we are on the currently selected tab then... if ((_ribbonRadioButton.RibbonTab != null) && (_ribbon.SelectedTab == _ribbonRadioButton.RibbonTab)) { // ...layout so the visible change is made OnNeedPaint(true); } } if (updatePaint) { // If this radio button is actually defined as visible... if (_ribbonRadioButton.Visible || _ribbon.InDesignMode) { // ...and on the currently selected tab then... if ((_ribbonRadioButton.RibbonTab != null) && (_ribbon.SelectedTab == _ribbonRadioButton.RibbonTab)) { // ...repaint it right now OnNeedPaint(false, ClientRectangle); } } } }