private void OnGroupPropertyChanged(object sender, PropertyChangedEventArgs e)
{
bool updateLayout = false;
bool updatePaint = false;
switch (e.PropertyName)
{
case "Visible":
case "AllowCollapsed":
case "DialogBoxLauncher":
case "MaximumWidth":
case "MinimumWidth":
updateLayout = true;
break;
case "TextLine1":
_viewNormalTitle.MakeDirty();
_viewCollapsedText1.MakeDirty();
updateLayout = true;
break;
case "TextLine2":
_viewNormalTitle.MakeDirty();
_viewCollapsedText2.MakeDirty();
updateLayout = true;
break;
case "Image":
updatePaint = true;
break;
}
if (updateLayout)
{
// If we are on the currently selected tab then...
if ((_ribbonGroup.RibbonTab != null) &&
(_ribbon.SelectedTab == _ribbonGroup.RibbonTab))
{
// ...layout so the visible change is made
OnNeedPaint(true);
}
}
if (updatePaint)
{
// If this button is actually defined as visible...
if (_ribbonGroup.Visible)
{
// ...and on the currently selected tab then...
if ((_ribbonGroup.RibbonTab != null) &&
(_ribbon.SelectedTab == _ribbonGroup.RibbonTab))
{
// ...repaint it right now
OnNeedPaint(false, ClientRectangle);
}
}
}
}