XAML 不同命名空间中的转换器

XAML Converter in different namespace

我正在 VC2013 中开发一个 c# Windows Phone 8.1 应用程序,偶然发现了一个奇怪的问题。

为了使我的代码更加'clean',我决定将我的应用程序的不同部分放入不同的文件夹中。在c#代码中从这些文件夹中调用XAML页是没有问题的。

但是 我似乎在 XAML 代码本身中链接这些文件夹时遇到问题。例如我有以下结构:

root, Files: App.cs+xaml, Mainpage.cs+xaml
|
-- Folder: Login
     |
     -- Files: LoginPage.cs+xaml
-- Folder: Converters
     |
     -- Files: converterClass.cs

为了像往常一样使用 converterClass.cs 中的 IValueConverter,我将以下内容放入 XAML 文件的 Header 中:

<Page
 x:Class="myApp.Login.LoginPage"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:local="using:meinStundenplaner.Login"
 xmlns:myConverter="using:myApp.Converters"
 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 mc:Ignorable="d"
 Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Page.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="../Styles/standardStyles.xaml"/>
        </ResourceDictionary.MergedDictionaries>

        <myConverter:DateTimeConverter x:Key="DateTimeConverter" />
        ... some more converters

    </ResourceDictionary>
</Page.Resources>
...

现在发生了,如果我键入 <myConverter:,自动完成会像往常一样找到我的转换器 类,但是在编译(它正在编译)和在设备 none 上测试时转换器工作,而且我在 Error-list 说

中收到错误
The name 'DateTimeConverter' in namespace 'using:myApp.Converters' does not exist.

我哪里错了?

哇...在使用 VS2015 后同样的错误仍然存​​在,我尝试了一些设置和东西。

一直很好奇,为什么会报那么多错,编译部署。问题似乎不一致。

解决方案与预期不同:

您必须将 Solution Platforms 设置为 x86 而不是 ARM(我需要在设备上部署)。幸运的是 VS2015 在一个方便的快捷方式中有这个选项,你不能说 VS2013.

不过还是解决了...