ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupCustomControl.OnCustomPropertyChanged C# (CSharp) Method

OnCustomPropertyChanged() private method

private OnCustomPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void
sender object
e System.ComponentModel.PropertyChangedEventArgs
return void
        private void OnCustomPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            bool updateLayout = false;
            bool updatePaint = false;

            switch (e.PropertyName)
            {
                case "Enabled":
                    UpdateEnabled(LastCustomControl);
                    break;
                case "Visible":
                    UpdateVisible(LastCustomControl);
                    updateLayout = true;
                    break;
                case "CustomControl":
                    updateLayout = true;
                    break;
            }

            if (updateLayout)
            {
                // If we are on the currently selected tab then...
                if ((_ribbonCustomControl.RibbonTab != null) &&
                    (_ribbon.SelectedTab == _ribbonCustomControl.RibbonTab))
                {
                    // ...layout so the visible change is made
                    OnNeedPaint(true);
                }
            }

            if (updatePaint)
            {
                // If this button is actually defined as visible...
                if (_ribbonCustomControl.Visible || _ribbon.InDesignMode)
                {
                    // ...and on the currently selected tab then...
                    if ((_ribbonCustomControl.RibbonTab != null) &&
                        (_ribbon.SelectedTab == _ribbonCustomControl.RibbonTab))
                    {
                        // ...repaint it right now
                        OnNeedPaint(false, ClientRectangle);
                    }
                }
            }
        }