c# - 值转换器显示在 Intellisense 中,但编译器无法在 C# WinRT 应用程序中找到?

标签 c# xaml windows-runtime ivalueconverter

我的 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编辑器或编译器却找不到?

最佳答案

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

关于c# - 值转换器显示在 Intellisense 中,但编译器无法在 C# WinRT 应用程序中找到?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21355954/

相关文章:

c# - 如何将组件的大小链接到窗口大小?

c# - 如何在 Entity Framework 中重命名迁移表?

c# - PropertyDescriptor 和 WPF 绑定(bind)机制

c# - 调整捕捉 View 大小时没有 SizeChanged 事件

c# - 如何在 ListView 中访问 WebView 的 NavigateToString 属性

configuration - 有没有办法在 Windows Store 应用程序的 ApplicationSettings 中存储自己的类的实例?

c# - 将字符串按 ','分割成除 ','以外的数组()

c# - excel 2010和2013中的数据模型//数据检索

c# - GroupStyle 和 Expander.IsExpanded 绑定(bind)的问题

xaml - Xamarin 表单在 TabbedPage 中添加按钮