错误 Xaml 命名空间
Error Xaml namespace
我正在学习实现值转换器的教程。我收到此代码的错误:
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>
我收到一个错误
The name "BooleanToVisibilityConverter" does not exist in the namespace "using:TestApp10"
该函数在 App.xaml.cs 文件中定义。
谢谢。
这似乎是 XAML Designer 中的智能感知错误。请确保您已正确实施 BooleanToVisibilityConverter
。然后您可以尝试按照以下步骤修复此错误。
- 在文件资源管理器中打开您的项目,删除 bin 和 obj文件夹
- 在 Visual Studio 中,右键单击您的解决方案,然后 select 清理。
- 右键单击您的解决方案,然后select 重建。
在此之后,您的错误应该消失了。如果您仍然遇到此错误,您可以尝试在 Visual Studio.
中重新打开您的项目
我正在学习实现值转换器的教程。我收到此代码的错误:
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>
我收到一个错误
The name "BooleanToVisibilityConverter" does not exist in the namespace "using:TestApp10"
该函数在 App.xaml.cs 文件中定义。
谢谢。
这似乎是 XAML Designer 中的智能感知错误。请确保您已正确实施 BooleanToVisibilityConverter
。然后您可以尝试按照以下步骤修复此错误。
- 在文件资源管理器中打开您的项目,删除 bin 和 obj文件夹
- 在 Visual Studio 中,右键单击您的解决方案,然后 select 清理。
- 右键单击您的解决方案,然后select 重建。
在此之后,您的错误应该消失了。如果您仍然遇到此错误,您可以尝试在 Visual Studio.
中重新打开您的项目