We have a WPF windows application that contains a stackpanel control, that I want to be visible only for testing, but not when it is in production.
We’d like to store the visibility value of that stackpanel in the application configuration file (app.config).
What is the WPF way of achieving this?
First, you create your property in Visual Studio by going to the Project Properties/Settings and creating an Application-scope bool
ShowMyStackPanel. This will automatically (1) create aSettingsclass in thePropertiesnamespace and (2) add the following to your app.config:In your WPF window, you can now simply bind to
Properties.Settings.Default.ShowMyStackPanelusing aBooleanToVisibilityConverter: