【发布时间】:2015-01-02 02:45:02
【问题描述】:
我在 x64 Windows 8.1 上运行 Visual Studio 2013 社区更新 4,并在 2014 年 12 月 30 日应用了所有可用更新。我在配备 2 个处理器和 4Gig 的 MacBook Pro 上的 VMWare Fusion 7 上运行 Windows 8.1。使用 C#、标准空白模板,并添加我自己的自定义类。我已将命名空间添加到 MainPage.xaml:
<Page
x:Class="BindingWithValueConverters.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindingWithValueConverters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:valueconverter="using:BindingWithValueConverters.Converters"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
DataContext="{Binding WeatherViewModel, RelativeSource={RelativeSource Self}}">
<Page.Resources>
<valueconverter:DateToStringConverter x:Key="DateToStringConverter" />
</Page.Resources>
...
“红色波浪线”仍保留在“valueconverter:DateToStringConverter”下;如果我删除该行并开始输入,“va...”Intellisense 会选择“valueconverter:”,因此命名空间是“那里”。然后,“DateToStringConverter”类显示为自动完成的一个选项。一旦被接受,经过短暂的延迟后,红色波浪线会回来指定:
The type "DateToStringConverter" is not accessible.
代码构建和运行没有错误。我可以继续盲目地编码。不过,最好解决这个问题。不胜感激。
我已经清理了项目。我已经删除了 *.suo 文件。电话仿真器像在非 VM 上一样运行。我已经在 Windows 8.1 机器(没有 VM)上运行了这个确切的项目,并且没有这个问题。我怀疑智能感知。如果有帮助,这是我的转换器类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;
namespace BindingWithValueConverters.Converters
{
class DateToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
//throw new NotImplementedException();
DateTime date = (DateTime)value;
return String.Format("{0:dddd} - {0:d}", date);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
VMWare/Mac 是工作和不工作的明显区别;但是,我希望我的 VMWare 部署或 Visual Studio 部署中缺少有关 Intellisense 的参数可以解决此问题。 Intellisense 正在该项目的其他任何地方工作。
谢谢!
【问题讨论】:
标签: c# xaml visual-studio-2013 intellisense