private void OnGalleryPropertyChanged(object sender, PropertyChangedEventArgs e)
{
bool updateLayout = false;
bool updatePaint = 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 ((_ribbonGallery.RibbonTab != null) &&
(_ribbon.SelectedTab == _ribbonGallery.RibbonTab))
{
// ...layout so the visible change is made
OnNeedPaint(true);
}
}
if (updatePaint)
{
// If this button is actually defined as visible...
if (_ribbonGallery.Visible || _ribbon.InDesignMode)
{
// ...and on the currently selected tab then...
if ((_ribbonGallery.RibbonTab != null) &&
(_ribbon.SelectedTab == _ribbonGallery.RibbonTab))
{
// ...repaint it right now
OnNeedPaint(false, ClientRectangle);
}
}
}
}