1

I am trying to use the BooleanToCollapsingVisibilityConverter in the Catel.MVVM.Converters namespace but the XAML designer does not find the type and breaks the build:

XLS0414 The type 'converters:BooleanToCollapsingVisibilityConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

I have already restarted Visual Studio, rebuilt the project, cleared the build caches, tried it in a blank UWP project - but all to no avail. In normal code I have no problem instantiating the converters. I have tightly followed the Catel Documentation. What am I doing wrong?

Sample code to reproduce the problem:

<controls:Page
    x:Class="App1.Views.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App1"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="using:Catel.Windows.Controls"
    xmlns:converters="using:Catel.MVVM.Converters"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <Border Background="Black" Width="500" Height="500" Visibility="{Binding Visible, Converter={converters:BooleanToCollapsingVisibilityConverter}}"/>
        <Button Command="{Binding ToggleVisibility}">Toggle Visibility</Button>
    </Grid>
</controls:Page>
TradeItEasy
  • 129
  • 8

1 Answers1

2

The problem is solved by declaring the Converter as a static resource:

<Page.Resources>
    <converters:BooleanToCollapsingVisibilityConverter x:Key="BoolToVisibilityConverter"/>
</Page.Resources>

and using it later as

Visibility="{Binding Visible, Converter={StaticResource BoolToVisibilityConverter}}"
TradeItEasy
  • 129
  • 8