I am trying out a simple WPF application. The XAML code is:
<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 a class Employee that is as follows in the same project:
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 the error:
Error 1 The tag 'Employee' does not exist in XML namespace 'clr-namespace:WpfApplication1;assembly=WpfApplication1'. Line 9 Position 10.