【问题标题】:Value converter shows up in Intellisense but can't be found by compiler in C# WinRT app?值转换器显示在 Intellisense 中,但编译器在 C# WinRT 应用程序中找不到?
【发布时间】:2014-01-25 20:37:59
【问题描述】:

我有一个值转换器位于我的 WinRT 应用程序使用的共享项目中。也就是说,转换器在另一个项目/装配中,而不是在使用它的项目/装配中。我已将另一个项目的命名空间添加到我的 XAML 中,并且 IDE 没有将其标记为未解析:

<UserControl xmlns:CommonConverters="using:Common_WinStore.Converters">

我还为它添加了一个资源入口:

<UserControl.Resources>
    <CommonConverters:DebugBindingConverter x:Key="DebugBindingConverter"/>
</UserControl.Resources>

但是,IDE 编辑器将 CommonConverters:DebugBindingConverter 标记为错误:

The name DebugBindingConverter does not exist in the namespace "using:Common_WinStore.Converters"

真正令人讨厌的是,当我键入 CommonConverters: 时,Intellisense 会在列表中弹出 DebugBindingConverter,我使用它来自动完成资源引用。

为什么 Intellisense 可以找到它,但 IDE 编辑器或编译器却找不到?

【问题讨论】:

  • 我每次使用转换器时都会遇到这个问题,尤其是在 WinRT C# 应用程序中,运行应用程序时它是否有效??

标签: c# xaml windows-runtime ivalueconverter


【解决方案1】:

我之前遇到过这个问题。当您在项目(解决方案)中添加新文件但不保存项目(解决方案)时,有时会发生这种情况,智能感知会解析它但编译器不会编译,因为它尚未包含在项目文件中。因此,保存所有文件应该会有所帮助。有时问题会在重新启动 Visual Studio 并重建项目/解决方案后消失。

【讨论】:

    猜你喜欢
    • 2014-02-05
    • 2011-07-02
    • 2014-05-28
    • 1970-01-01
    • 1970-01-01
    • 2017-09-19
    • 1970-01-01
    • 2014-08-21
    • 2022-07-08
    相关资源
    最近更新 更多