private void OnGalleryPropertyChanged(object sender, PropertyChangedEventArgs e)
{
bool updateLayout = false;
const bool UPDATE_PAINT = false;
switch (e.PropertyName)
{
case "TextLine1":
_viewLargeText1.MakeDirty();
updateLayout = true;
break;
case "TextLine2":
_viewLargeText2.MakeDirty();
updateLayout = true;
break;
case "ImageLarge":
case "ImageList":
case "LargeItemCount":
case "MediumItemCount":
case "ItemSizeMinimum":
case "ItemSizeMaximum":
case "ItemSizeCurrent":
updateLayout = true;
break;
case "Enabled":
UpdateEnabled(LastGallery);
break;
case "Visible":
UpdateVisible(LastGallery);
updateLayout = true;
break;
}
if (updateLayout)
{
// If we are on the currently selected tab then...
if ((GroupGallery.RibbonTab != null) &&
(_ribbon.SelectedTab == GroupGallery.RibbonTab))
{
// ...layout so the visible change is made
OnNeedPaint(true);
}
}
if (UPDATE_PAINT)
#pragma warning disable 162
{
// If this button is actually defined as visible...
if (GroupGallery.Visible || _ribbon.InDesignMode)
{
// ...and on the currently selected tab then...
if ((GroupGallery.RibbonTab != null) &&
(_ribbon.SelectedTab == GroupGallery.RibbonTab))
{
// ...repaint it right now
OnNeedPaint(false, ClientRectangle);
}
}
}
#pragma warning restore 162
}