C# xaml没有看到我的ivalueconverter
我知道以前有人问过这个问题,但根据这些答案,我真的不知道这里发生了什么,因为以前的提问者似乎把他们的iValueConverter放在了不同的类或文件下。我的IValueConverter位于命名空间进程中,但由于某些原因,我收到了错误: 名称空间中不存在名称“LatValueConverter” “clr命名空间:Proc” 名称空间中不存在名称“LongValueConverter” “clr命名空间:Proc” 该代码用于加载外部文件,并根据文件中指定的lat/lon值放置图像。应用程序已构建,但图像未显示,这说明此方法失败。(仅显示以下相关代码) 此外,这些错误在visual studio错误列表中,但在xaml编辑器中键入C# xaml没有看到我的ivalueconverter,c#,.net,wpf,visual-studio-2015,ivalueconverter,C#,.net,Wpf,Visual Studio 2015,Ivalueconverter,我知道以前有人问过这个问题,但根据这些答案,我真的不知道这里发生了什么,因为以前的提问者似乎把他们的iValueConverter放在了不同的类或文件下。我的IValueConverter位于命名空间进程中,但由于某些原因,我收到了错误: 名称空间中不存在名称“LatValueConverter” “clr命名空间:Proc” 名称空间中不存在名称“LongValueConverter” “clr命名空间:Proc” 该代码用于加载外部文件,并根据文件中指定的lat/lon值放置图像。应用程序已
local:
后,LatValueConverter和LongValueConverter都会显示在下拉菜单中。我已尝试清理/重建,但仍会出现错误。有没有关于如何解决这个问题的想法
Visual Studio 2015更新1编辑:
我在使用Visual Studio 2015 Update 1时注意到了这个问题,于是写了这个问题。我在Visual Studio 2015中重新加载了该项目(无更新),没有错误!这似乎是Visual Studio 2015 Update 1的一个bug。有人知道有什么工作吗
以下是xaml:
<Window x:Class="Proc.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:Proc"
mc:Ignorable="d">
<Window.Resources>
<ResourceDictionary>
<local:LatValueConverter x:Key="latValueConverter" /> <!-- Errors are here -->
<local:LongValueConverter x:Key="longValueConverter" /> <!-- Errors are here -->
<sys:Double x:Key="mapWidth">950</sys:Double>
<sys:Double x:Key="mapHeight">530</sys:Double>
</ResourceDictionary>
</Window.Resources>
删除您的
ResourceDictionary
对象;所以它最终应该是这样的:
<Window.Resources>
<local:LatValueConverter x:Key="latValueConverter" /> <!-- Errors are here -->
<local:LongValueConverter x:Key="longValueConverter" /> <!-- Errors are here -->
<sys:Double x:Key="mapWidth">950</sys:Double>
<sys:Double x:Key="mapHeight">530</sys:Double>
</Window.Resources>
950
530
我在VS 2015更新1上遇到了同样的问题
代码构建和运行正常,但设计器抱怨“某些元素尚未构建…”,如果我将鼠标悬停在XAML的“有问题”部分,工具提示将显示“MyCustomConverter在命名空间中不存在等…”
出于某种原因,在我的例子中,只有当我将解决方案构建为任何CPU时,我才能获得这种设计器行为。如果我将其强制为x64,则设计器可以工作
我还没有尝试VS 2015 update 2。谢谢,但这并没有解决它。我的visual studio可能有问题?可能有。确保已安装最新版本。还要进行清洁和重建。转换方法被调用了吗?我在两个转换的返回上都设置了断点,它们从未被激发。此外,我还进行了清理/重建。因此,似乎没有调用转换。请参阅编辑-我认为这是VS 2015 update 1的一个错误。
<Window.Resources>
<local:LatValueConverter x:Key="latValueConverter" /> <!-- Errors are here -->
<local:LongValueConverter x:Key="longValueConverter" /> <!-- Errors are here -->
<sys:Double x:Key="mapWidth">950</sys:Double>
<sys:Double x:Key="mapHeight">530</sys:Double>
</Window.Resources>