I'm trying to learn data binding but C# crashes on this very simple example. This crash happens everytime I try to set the property PersonName the Person object.
<Window x:Class="BindingTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:BindingTest"
Title="Simple Data Binding Sample">
<Window.Resources>
<src:Person x:Key="myDataSource" PersonName=""/>
</Window.Resources>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.ComponentModel;
namespace BindingTest
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
}
public class Person : INotifyPropertyChanged
{
String internal_PersonName;
public Person()
{
}
public String PersonName
{
get
{
return internal_PersonName;
}
set
{
PersonName = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("PersonName"));
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
}
It literally crashes a second or two after typing "PersonName=". Every time.
Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1
Installed Edition: C# Express
Microsoft Visual C# 2008 91910-152-0000061-60471
Microsoft Visual C# 2008
Hotfix for Microsoft Visual C# 2008 Express Edition with SP1 - ENU (KB945282) KB945282
This hotfix is for Microsoft Visual C# 2008 Express Edition with SP1 - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/945282.
Hotfix for Microsoft Visual C# 2008 Express Edition with SP1 - ENU (KB946040) KB946040
This hotfix is for Microsoft Visual C# 2008 Express Edition with SP1 - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946040.
Hotfix for Microsoft Visual C# 2008 Express Edition with SP1 - ENU (KB946308) KB946308
This hotfix is for Microsoft Visual C# 2008 Express Edition with SP1 - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946308.
Hotfix for Microsoft Visual C# 2008 Express Edition with SP1 - ENU (KB947540) KB947540
This hotfix is for Microsoft Visual C# 2008 Express Edition with SP1 - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947540.
Hotfix for Microsoft Visual C# 2008 Express Edition with SP1 - ENU (KB947789) KB947789
This hotfix is for Microsoft Visual C# 2008 Express Edition with SP1 - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947789.
Hotfix for Microsoft Visual C# 2008 Express Edition with SP1 - ENU (KB958017) KB958017
This hotfix is for Microsoft Visual C# 2008 Express Edition with SP1 - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/958017.
OS Name Microsoft Windows XP Home Edition
Version 5.1.2600 Service Pack 3 Build 2600
I just uninstalled .NET 3.5 SP1 and reinstalled it. No effect.
Any help would be greatly appreciated