2016-08-31 264 views
0

我正在学习一个教程来实现一个值转换器。我收到错误此代码:错误Xaml命名空间

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> 

我得到一个错误

“BooleanToVisibilityConverter” 这个名字并不在命名空间中存在 “使用:TestApp10”

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

谢谢。

+0

它解决了错误Thx。但代码仍然不工作(http://stackoverflow.com/questions/39333533/trouble-binding-xaml-uwp) – rur2641

回答

1

这似乎是XAML Designer中的智能感知错误。请确保您已正确实施BooleanToVisibilityConverter。然后你可以尝试以下步骤来解决这个错误。

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

在此之后,您的错误应该消失。如果仍然出现此错误,则可以尝试在Visual Studio中重新打开您的项目。