Reputation: 13
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?
Upvotes: 1
Views: 345
Reputation: 2113
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;
}
}
Upvotes: 1