我在使用命名空间时遇到问题,我似乎在追查错误,现在我只剩下我不明白的地方了。我所有的文件都有相同的命名空间,我真的不认为我需要一个小程序。
Example.xaml
<UserControl x:Class="Example"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:chart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Chart"
xmlns:chartView="clr-namespace:Telerik.Windows.Controls.ChartView;assembly=Telerik.Windows.Controls.Chart"
xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
xmlns:local="clr-namespace:Example.ExampleViewModel"
xmlns:System="clr-namespace:System;assembly=mscorlib">
<telerikQuickStart:QuickStart.ExampleHeader>
<TextBlock Text="Atlanta Sales Dashboard" Margin="8" />
</telerikQuickStart:QuickStart.ExampleHeader>
<UserControl.DataContext>
<local:ExampleViewModel />
</UserControl.DataContext> /
ExampleViewModel.cs
using System;
using System.Collections.ObjectModel;
using System.Linq;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Map;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using System.Windows.Resources;
using System.Xml;
namespace Example.ExampleViewModel
{
public class ExampleViewModel : ViewModelBase
ExampleViewModel 仍然给我以下错误。
Error 1 The name "ExampleViewModel" does not exist in the namespace "clr-namespace:Example.ExampleViewModel". D:\visual studio 12\Projects\Map1\Map1\Example.xaml 14 9 Map1
Error 2 The namespace '<global namespace>' already contains a definition for 'Example' D:\visual studio 12\Projects\Map1\Map1\obj\x86\Debug\Example.g.cs 62 22 Map1