1

I've got a user control which is supposed to fire an event when the visibility or the enable status changes.

My problem is the events fire on Visual Studio's designer too, which is irritating since during design they act in an unexpected behaviour.

How can I prevent that?

1 Answers1

1

Add this property to your (base) class and check its value in the RaiseEventXYZ or FireEventXYZ methods...

public class MyClass
{
    public bool IsDesignMode { get;private set; }
    public MyClass()
    {
        IsDesignMode = LicenseManager.UsageMode == LicenseUsageMode.Designtime;
    }
}
Michael
  • 1,931
  • 2
  • 8
  • 22