Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 484 Bytes

user-control.md

File metadata and controls

26 lines (21 loc) · 484 Bytes

User Controls

Execute code on load (only in an application, not in VS design mode)

// USE THIS FOR WPF
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
{
    // in Visual Studio
}
else
{
    // in the wild
}

Actually, this seems to work better

// USE THIS FOR WINFORMS
bool isInFormsDesignerMode = (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv");
if (Process.GetCurrentProcess().ProcessName == "devenv")