问题
I am following a tutorial to implement a value converter. I receive an error for this code:
public class BooleanToVisibilityConverter : IValueConverter
{
//
}
<Application
x:Class="TestApp10.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TestApp10"
RequestedTheme="Light">
<Application.Resources>
<local:BooleanToVisibilityConverter x:Key="TrueToVisibleConverter" />
<local:BooleanToVisibilityConverter x:Key="FalseToVisibleConverter" IsReversed="True" />
</Application.Resources>
I get an error
The name "BooleanToVisibilityConverter" does not exist in the namespace "using:TestApp10"
The function is defined in the App.xaml.cs file.
Thank you.
回答1:
This seems to be an intellisense error in XAML Designer. Please make sure you have implemented your BooleanToVisibilityConverter
correctly. Then you can try with following steps to fix this error.
- Open your project in File Explorer, delete bin and obj folder
- In Visual Studio, right-click your Solution, and select Clean.
- Right-click your Solution, and select Rebuild.
After this, your error should be gone. If you still get this error, you can try to reopen your project in Visual Studio.
来源:https://stackoverflow.com/questions/39239879/error-xaml-namespace