I create a textbox in xaml to monitor a value. this is useful when developing but i would like to hide it when running in release compile. i know i can hide the texbox by setting visibility, but i would like to automate it.
thanks.
I´m not sure if you can do this directly in XAML by defining conditional compilation directives. But it works using the codebehind file.
First give your TextBox a name to access it in the codebehind file.
<TextBox x:Name="debugTextBox" />
and then add code to your codebehind (like the constructor)
#if DEBUG
debugTextBox.Visibility = Visibility.Visible;
#else
debugTextBox.Visibility = Visibility.Hidden; // or Collapsed
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With