Search code examples
c#wpfobjecthideexpression-blend

Hide c# object in design mode (Expression Blend)


I have a DLL that contains all my object I need to build my application.

I want to hide some of them when I'm in Blend. For example, I don't want the graphic designer to use my base classes, so I need to hide them in design mode (Blend).

I tried to add [Browsable(false)] but it works only for a property or event. I tried DesignTimeVisible(false)] but doesn't work either...

Is there a way to hide an object and not just a property? And I need it for Blend, because sometimes you can do something in VS but not in Blend.

Thanks


Solution

  • try this inside your XAML code-behind (or similar)

    if (!DesignerProperties.GetIsInDesignMode(this))
    {
        // Do non-design mode stuff here}
    }