C# 名称为;“1类”;命名空间中不存在“0”;clr名称空间:WpfApplication2";
我有一个标题上的问题 为什么字段C# 名称为;“1类”;命名空间中不存在“0”;clr名称空间:WpfApplication2";,c#,.net,wpf,xaml,namespaces,C#,.net,Wpf,Xaml,Namespaces,我有一个标题上的问题 为什么字段中的文件Edycja.xaml会收到错误消息 错误7命名空间“clr-命名空间:WPFAApplication2”中不存在名称“Class1” 我在每个文件中都有每个用法,这需要这个 Edycja.xaml <Window x:Class="AllSportsBets102.Edycja" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x
中的文件Edycja.xaml会收到错误消息
错误7命名空间“clr-命名空间:WPFAApplication2”中不存在名称“Class1”
我在每个文件中都有每个用法,这需要这个
Edycja.xaml
<Window
x:Class="AllSportsBets102.Edycja"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Edycja"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterScreen"
x:Name="Window"
xmlns:v="clr-namespace:WpfApplication2">
<Window.Resources>
<v:Class1 x:Key="con" />
</Window.Resources>
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="129*" />
<RowDefinition Height="47*" />
</Grid.RowDefinitions>
<DataGrid Grid.Row="0" ItemsSource="{Binding Path=people, ElementName=Window}" AutoGenerateColumns="False" >
<DataGrid.Columns>
<DataGridTextColumn Header="ClientName" Binding="{Binding clientName}" IsReadOnly="True"/>
<DataGridTextColumn Header="ClientType" Binding="{Binding clientType}" IsReadOnly="True"/>
<DataGridComboBoxColumn Header="Product" Width="120" CanUserSort="False" SelectedValueBinding="{Binding product}" >
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding Path=clientType,Converter={StaticResource con}}"/>
<Setter Property="SelectedValue" Value="{Binding Path=product}"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding Path=clientType,Converter={StaticResource con}}" />
<Setter Property="SelectedValue" Value="{Binding Path=product}"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Grid>
</Window>
Edycja.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data.SqlClient;
using System.Data;
using System.Globalization;
using System.Net;
using System.Xml;
using System.Xml.Schema;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using System.Net.Mail;
using Xceed.Wpf.Toolkit;
using AllSportsBets102.DataGridHelpers;
using AllSportsBets102;
using System.ComponentModel;
namespace AllSportsBets102
{
public class person
{
public string product
{
get;
set;
}
public string clientType
{
get;
set;
}
public string clientName
{
get;
set;
}
}
public partial class Edycja : Window
{
Funkcje FK;
EdycjaKursow EK;
public List<string> ListaDyscyplina = new List<string>();
public List<string> ListaSystemRozgrywek = new List<string>();
public List<string> ListaKraj = new List<string>();
public List<string> ListaNazwaLigi = new List<string>();
public List<string> ListaKolejka = new List<string>();
public List<string> ListaSystemTypowan = new List<string>();
public List<string> ListaGospodarze = new List<string>();
public List<string> ListaGoscie = new List<string>();
public static List<Data2> dataSourcetmpXXX = new List<Data2>();
public ObservableCollection<person> people
{
get;
set;
}
public static ObservableCollection<string> nationalProducts
{
get;
set;
}
public static ObservableCollection<string> interNationalProducts
{
get;
set;
}
public Edycja()
{
people = new ObservableCollection<person>()
{
new person(){product = "a",clientType = "National", clientName="mbt"},
new person(){product = "p",clientType = "International", clientName="patni"},
new person(){product = "b",clientType = "National", clientName="igate"},
new person(){product = "r",clientType = "International", clientName="cgi"}
};
nationalProducts = new ObservableCollection<string>() { "a", "b", "c", "d", "e" };
interNationalProducts = new ObservableCollection<string>() { "p", "q", "r", "s", "t" };
InitializeComponent();
}
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
使用System.Windows;
使用System.Windows.Controls;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;
使用System.Windows.Navigation;
使用System.Windows.Shapes;
使用System.Data.SqlClient;
使用系统数据;
利用制度全球化;
Net系统;
使用System.Xml;
使用System.Xml.Schema;
使用System.Collections.ObjectModel;
使用System.Text.RegularExpressions;
使用System.Net.Mail;
使用Xceed.Wpf.Toolkit;
使用AllSportsBets102.DataGridHelpers;
使用AllSportsBets102;
使用系统组件模型;
命名空间AllSportsBets102
{
公共阶层人士
{
公共字符串产品
{
得到;
设置
}
公共字符串clientType
{
得到;
设置
}
公共字符串clientName
{
得到;
设置
}
}
公共部分类Edycja:窗口
{
Funkcje FK;
埃迪克雅库索埃克;
public List listadysyplina=新列表();
public List ListaSystemRozgrywek=新列表();
public List ListaKraj=新列表();
public List ListaNazwaLigi=新列表();
public List ListaKolejka=新列表();
public List ListaSystemTypowan=新列表();
public List listagosDarze=新列表();
public List ListaGoscie=new List();
公共静态列表数据源cetmpxxx=新列表();
公众观察收集人
{
得到;
设置
}
公共静态可观测收集国家产品
{
得到;
设置
}
公共静态可观测集合国际产品
{
得到;
设置
}
公共教育
{
人员=新的可观察集合()
{
新人(){product=“a”,clientType=“National”,clientName=“mbt”},
新人(){product=“p”,clientType=“International”,clientName=“patni”},
新人(){product=“b”,clientType=“National”,clientName=“igate”},
新人(){product=“r”,clientType=“International”,clientName=“cgi”}
};
nationalProducts=新的可观测集合(){“a”、“b”、“c”、“d”、“e”};
interNationalProducts=新的ObservableCollection(){“p”、“q”、“r”、“s”、“t”};
初始化组件();
}
}
}
在创建新类并在XAML中声明它时,通常会出现此错误。请尝试构建,如果错误是真的,它仍然会出现
但是,这通常会导致验证错误消失,应用程序将准备就绪。Class1是否标记为public?您说过名称空间是正确的,但请检查Class1是否位于WPFAApplication2名称空间中,并且与此xaml文件位于同一程序集中。因此Class1是public,Class1位于WPFAApplication2名称空间中
命名空间WpfApplication2{public class Class1:IValueConverter
这是XAML解析器中的错误,还是生成错误?通常生成将更新基础符号文件,错误将消失。我还有一些其他错误,在它们的删除项目启动后。感谢男士:)很高兴提供帮助。我将我的评论作为答案发布。如果需要,请随意投票/接受你认为它是有用的,或者将来会对别人有用。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data.SqlClient;
using System.Data;
using System.Globalization;
using System.Net;
using System.Xml;
using System.Xml.Schema;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using System.Net.Mail;
using Xceed.Wpf.Toolkit;
using AllSportsBets102.DataGridHelpers;
using AllSportsBets102;
using System.ComponentModel;
namespace AllSportsBets102
{
public class person
{
public string product
{
get;
set;
}
public string clientType
{
get;
set;
}
public string clientName
{
get;
set;
}
}
public partial class Edycja : Window
{
Funkcje FK;
EdycjaKursow EK;
public List<string> ListaDyscyplina = new List<string>();
public List<string> ListaSystemRozgrywek = new List<string>();
public List<string> ListaKraj = new List<string>();
public List<string> ListaNazwaLigi = new List<string>();
public List<string> ListaKolejka = new List<string>();
public List<string> ListaSystemTypowan = new List<string>();
public List<string> ListaGospodarze = new List<string>();
public List<string> ListaGoscie = new List<string>();
public static List<Data2> dataSourcetmpXXX = new List<Data2>();
public ObservableCollection<person> people
{
get;
set;
}
public static ObservableCollection<string> nationalProducts
{
get;
set;
}
public static ObservableCollection<string> interNationalProducts
{
get;
set;
}
public Edycja()
{
people = new ObservableCollection<person>()
{
new person(){product = "a",clientType = "National", clientName="mbt"},
new person(){product = "p",clientType = "International", clientName="patni"},
new person(){product = "b",clientType = "National", clientName="igate"},
new person(){product = "r",clientType = "International", clientName="cgi"}
};
nationalProducts = new ObservableCollection<string>() { "a", "b", "c", "d", "e" };
interNationalProducts = new ObservableCollection<string>() { "p", "q", "r", "s", "t" };
InitializeComponent();
}
}
}