My CustomControls UI element Visibility
is bound through a BoolToVisibilityConverter, see code below :
<cc:CustomFFU LabelText="FFUZoneF_2-1" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="1" Width="55" Height="35"
InstanceAddress="MCS1.Cleanroom.ProcessCell.UN_ZonesF.EM_FFU.CM_FFU2_1"
Visibility="{Binding VisibilityFFUView, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolToVisibilityConverter}}" />
The code works as it should, however during design-time the visibility
is Collapsed
. So every CustomControl on my window is not visible during development. Quite annyoning..
How is the visibility during design-time
fixed to Visibility
?
Ps. when I delete the BoolToVisibilityConverter, the status changes from Collapsed to Visible? Perhaps, because when designing the value represent false. Just a guess.
CodePudding user response:
If you are using Visual Studio, you should add d:Visibility="Visible" property in xaml element that you want to be visible in design time
like this:
<Button Visibility="{Binding Property}" d:Visibility="Visible" />
and make sure that you have Ignorable="d" from "http://schemas.openxmlformats.org/markup-compatibility/2006" namespace on your root xaml element like this:
<Window x:Class="WpfApp2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApp2"
add this ---> xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
and this ---> mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>
This doesn't work in Rider wpf designer