我正在测试 VS 2013 并且有一个相当奇怪的错误:我正在加载一个 XAML 文件,该文件使用命名空间来实现 Valueconverter。运行时此 WORKS finde,但在开发视图中我收到一个错误,指出未找到转换器。我试图清理解决方案,删除 .user 和 .suo 文件,但无济于事
代码如下所示:
<RibbonWindow x:Class="bla.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.caliburnproject.org"
xmlns:Converter="clr-namespace:bla.Utils"
Title="bla" Width="1024" Height="768" Icon="/bla;component/Images/Table.ico" MinWidth="300" MinHeight="300">
<RibbonWindow.Resources>
<Converter:SpssVarTypeConverter x:Key="SpssVarTypeConverter"></Converter:SpssVarTypeConverter>
</RibbonWindow.Resources>
</RibbonWindow>
和转换器:
using bla.SPSS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
namespace bla.Utils
{
public class SpssVarTypeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var type = (Types)value;
if (type == Types.numerisch)
{
return Brushes.LightBlue;
}
else
{
return Brushes.PaleVioletRed;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
有人知道如何解决这个问题吗?