This question touches me for a long time: Can I have a condition that is true if the Visual Studio designer fulfills it, and false otherwise?
For example, (WPF), I want to use a special BoolToVisibilityConverter to bind the visibility property of some controls to the mouse above this control. I do this with the following XAML code:
<Image Width="50" Height="50" Source="../Images/MB_0010_tasks.ico" Margin="12,133,133,12" MouseLeftButtonUp="Image_MouseLeftButtonUp" Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=IsMouseOver, Converter={StaticResource __boolToVisibilityConverter}}" />
This leads to the fact that the elements are not visible in the visual designer view. Is there a way to tell the converter something like this:
#if DESIGNER return Visibility.Visible; #endif return b ? Visibility.Visible : Visibility.Hidden;
source share