Mc_Topaz
Mc_Topaz

Reputation: 637

XAML reference to System.Windows.Controls.BooleanToVisibilityConverter

In my WPF-application, targeting .NET Core 3.1, I'm trying to use the built-in System.Windows.Controls.BoolToVisibilityConverter

I think I have looked up the correct syntax for the XAML reference.

xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"

However I get a compile error:

'System.Windows.Controls' was not found. Verify that you are not missing an assembly reference. Also, verify that your project and all referenced assemblies have been built.

What can be the problem?

Upvotes: 2

Views: 1857

Answers (1)

Andy
Andy

Reputation: 12276

If you look at the documentation here:

https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.booleantovisibilityconverter?view=netcore-3.1

It's not in the dll you're using.

Namespace: System.Windows.Controls

Assembly: PresentationFramework.dll

Change the assembly.

    Title="MainWindow" Height="450" Width="800"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
    >
<Window.Resources>
    <controls:BooleanToVisibilityConverter x:Key="boolConv"/>
</Window.Resources>

Upvotes: 5

Related Questions