The name "Class1" does not exist in the namespace "clr-namespace:WpfApplication2"

I have a problem as in the title Why file Edycja.xaml in field <v:Class1 x:Key="con" /> receives an error message

Error 7 The name ' Class1 ' does not exist in the namespace ' clr- namespace: WpfApplication2 "

I have every using in each files, which required this.

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>

Class1.cs (this is converter)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AllSportsBets102;
using System.Windows.Data;
namespace WpfApplication2
{
    public class Class1 : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && !string.IsNullOrWhiteSpace(value.ToString()))
            {
                if (value.ToString() == "National")
                    return Edycja.nationalProducts;
                return Edycja.interNationalProducts;
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}

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();
        }
    }
}

Answers


This error commonly appears when creating a new class and declaring it in XAML. Try building, and if the error is real it will still be there.

Most often though, this will cause the validation error to go away and your application will be ready to go.


Need Your Help

Google's voice search speech recognition service

android speech-recognition

Google has speech recognition services available for use from mobile phones (Android has it built in, iPhone users can use the Google application) - http://www.google.com/mobile/. We've found one a...

How do we add a whole repository and not file by file in CVS?

cvs directory commit

Hello I am using a custom library which has a lot of files. Now in order to use that library I need to add all the files of that library to the local CVS. So when I cvs update, it shows me all the ...