You can bind to the DesignerProperties.IsInDesignMode
boolean property, which is true only if you are inside the designer. Here is an example:
<Window x:Class="Visitest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cm="clr-namespace:System.ComponentModel;assembly=PresentationFramework" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <BooleanToVisibilityConverter x:Key="conv"/> </Window.Resources> <Grid> <TextBox Margin="8" Background="Green" Visibility="{Binding (cm:DesignerProperties.IsInDesignMode), RelativeSource={RelativeSource Self}, Converter={StaticResource conv}}"/> </Grid> </Window>
user128300
source share