Search code examples
c#wpfvisual-studioxamlcompiler-warnings

"The property ... was not found in type ...", why doesn't this appear in build results?


I'm working on a C# WPF application, using Visual Studio 2022.

While running the application, I saw a checkbox, whose value did not change, although it should. This was caused by the following typo in the corresponding XAML-file:

IsChecked="{Binding SelectedProduct.Enable}"

While is should be:

IsChecked="{Binding SelectedProduct.Enabled}"

(mind the last letter of the property.)

I could easily see this in the XAML editor (there was a blue wave, indicating the error).
Then I started wondering if there would be other mistakes like this in my source code (there are lots of XAML files), so I decided to type the same error again and see what the compiler warning/hint/... would be, but to my surprise this kind of error/warning/hint/... is not even shown.

I believe there should be some configuration setting for this, but I have no idea where to look for this, hence my question:

In case I make spelling mistakes in my XAML-files, where should I look for an overview of those mistakes, preferably during the build of my application?

Thanks in advance

Edit after first answer:
I've found the "enable XAML" thing, but on another spot: "Tools" menu, "Options", "XAML Designer", "General", and it looks as follows:

XAML Designer screenshot

As it is already enabled, then why don't I see anything?

On the place, mentioned by Francesco, there is the following (the small dialog box is shown after having clicked the "Advanced" button):

General project Build output screenshot


Solution

  • I am afraid the binding paths are not evaluated during compile time in WPF. There is no support for compiled bindings using x:Bind.

    At runtime, you'll see warnings about binding failures if you debug the application in Visual Studio and have the Data Binding option set to anything else than Off in the Tools > Options > Debugging > Output Window > WPF Trace Settings dialog.