I am a newbie to WPF.
I am practising the sample code in WPF unleashed .
When I was trying to implement the Attached events , I modified the class name an Xaml file to a different class name , that is as same as my namespace of the new page and I am debugger
complains with this error:
Error 1 The namespace ” already contains a definition for ‘AboutDialog1’
Can anybody please let me know why am I getting such errors?
my code :
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="AboutDialog1" ListBox.SelectionChanged ="ListBox_selectionchanged"
Title="attachedevents">
<StackPanel>
<Label FontWeight="Bold" FontSize="20" Foreground="White">wp4 unleashed </Label>
<ListBox>
<ListBoxItem>chapter 1</ListBoxItem>
<ListBoxItem>chapter 2</ListBoxItem>
</ListBox>
</StackPanel>
namespace AboutDialog1
{
public partial class AboutDialog: Page
{
public AboutDialog()
{
}
void ListBox_selectionchanged(object sender, SelectionChangedEventArgs e)
{
if (e.AddedItems.Count > 0)
MessageBox.Show("you have selected " + e.AddedItems[0]);
}
}
x:Classshould point to a class, not the namespace containing it, so it should bex:Class="AboutDialog1.AboutDialog"