tags:

views:

76

answers:

1

I have some useful wpf buttons to test some functionality. It would be good not to show them in release but in debug indeed.

Doing it from code is easy. But I'd prefer a declarative solution.

+1  A: 

The only solution I know of is to create a static property somewhere like this:

public static Visibility IsDebug
{

if DEBUG

    return Visibility.Visible;

else

    return Visibility.Collapsed;

endif

}

Then use it in XAML like this:

<MyControl Visibility="{x:Static local:MyType.IsDebug}" />

XAML doesn't have anything for compiler flags.

Steven