I tried a simple WPF application. XAML Code:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:WpfApplication1;assembly=WpfApplication1"
Title="My First WPF Demo" Height="350" Width="525">
<Window.Resources>
<sys:Int32 x:Key="i">10</sys:Int32>
<local:Employee x:Key="emp2"></local:Employee> --> THIS LINE
</Window.Resources>
<StackPanel>
<TextBox x:Name="txtName" FontSize="18" Margin="20"></TextBox>
<Button x:Name="btnClickMe" FontSize="18" Margin="20"
Click="btnClickMe_Click">Click Me</Button>
<TextBlock x:Name="lblName" FontSize="18" Margin="20"></TextBlock>
<Label x:Name="lblEmpInfo" FontSize="18" Margin="20"></Label>
<Label x:Name="lblEmpInfo2" FontSize="18" Margin="20"></Label>
</StackPanel>
</Window>
I have an Employee class that looks like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WpfApplication1
{
public class Employee
{
public int ID { get; set; }
public string Name { get; set; }
}
}
When I try to build my project, I get an error message:
Error 1 The tag 'Employee' does not exist in the XML namespace 'CLR names: WpfApplication1; assembly = WpfApplication1 '. Line 9 Position 10.
source
share