private void OnEnabled(object sender, EventArgs e)
{
if ((_ribbonCustomControl != null) && (_ribbonCustomControl.Ribbon != null))
{
PropertyDescriptor propertyEnabled = TypeDescriptor.GetProperties(_ribbonCustomControl)["Enabled"];
bool oldValue = (bool)propertyEnabled.GetValue(_ribbonCustomControl);
bool newValue = !oldValue;
_changeService.OnComponentChanged(_ribbonCustomControl, null, oldValue, newValue);
propertyEnabled.SetValue(_ribbonCustomControl, newValue);
}
}