错误 Xaml 命名空间 [英] Error Xaml namespace

查看:27
本文介绍了错误 Xaml 命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习实现值转换器的教程.我收到此代码的错误:

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>

出现错误

命名空间using:TestApp10"中不存在名称BooleanToVisibilityConverter"

The name "BooleanToVisibilityConverter" does not exist in the namespace "using:TestApp10"

函数在 App.xaml.cs 文件中定义.

The function is defined in the App.xaml.cs file.

谢谢.

推荐答案

这似乎是 XAML 设计器中的智能感知错误.请确保您已正确实施您的 BooleanToVisibilityConverter.然后您可以尝试按照以下步骤修复此错误.

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.

  1. 在文件资源管理器中打开您的项目,删除 binobj 文件夹
  2. 在 Visual Studio 中,右键单击您的解决方案,然后选择清理.
  3. 右键单击您的解决方案,然后选择重建.

在此之后,您的错误应该消失了.如果您仍然遇到此错误,您可以尝试在 Visual Studio 中重新打开您的项目.

After this, your error should be gone. If you still get this error, you can try to reopen your project in Visual Studio.

这篇关于错误 Xaml 命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆