Error Xaml namespace

淺唱寂寞╮ 提交于 2019-12-25 06:12:45

问题


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.

  1. Open your project in File Explorer, delete bin and obj folder
  2. In Visual Studio, right-click your Solution, and select Clean.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!