private void OnCheckBoxPropertyChanged(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":
case "CheckState":
UpdateCheckState();
updatePaint = true;
break;
case "Enabled":
UpdateEnabledState();
updatePaint = true;
break;
case "ItemSizeMinimum":
case "ItemSizeMaximum":
case "ItemSizeCurrent":
UpdateItemSizeState();
updateLayout = true;
break;
case "KryptonCommand":
_viewLargeText1.MakeDirty();
_viewLargeText2.MakeDirty();
_viewMediumSmallText1.MakeDirty();
_viewMediumSmallText2.MakeDirty();
UpdateEnabledState();
UpdateCheckState();
updateLayout = true;
break;
}
if (updateLayout)
{
// If we are on the currently selected tab then...
if ((_ribbonCheckBox.RibbonTab != null) &&
(_ribbon.SelectedTab == _ribbonCheckBox.RibbonTab))
{
// ...layout so the visible change is made
OnNeedPaint(true);
}
}
if (updatePaint)
{
// If this check box is actually defined as visible...
if (_ribbonCheckBox.Visible || _ribbon.InDesignMode)
{
// ...and on the currently selected tab then...
if ((_ribbonCheckBox.RibbonTab != null) &&
(_ribbon.SelectedTab == _ribbonCheckBox.RibbonTab))
{
// ...repaint it right now
OnNeedPaint(false, ClientRectangle);
}
}
}
}