c# - DataGrid WPF StackOverFlow Exception -
I'm new to WPF and having problem with a DataGrid
setting is. My problem is that I have received the stack overflow exception
and the first name
debugger brakes on the set statement of the property I have followed the resources and in solving my problem Unable to:
Any help is greatly appreciated.
My code is:
Namespace Binding Test {Public Partial Square Main Window: Window {Public Men Window} {Initial} ObservableCollection & LT; Person & gt; Person = new insignificant collection & lt; Person & gt; () {New person () {first name = "zone", last name = "Smith"}, new person () {first name = "foo", last name = "bar"}}; DataGrid1.ItemsSource = Individuals; } Class person: INotifyPropertyChanged {public string first name {get {return FirstName; } Set {FirstName = value; NotifyPropertyChanged ("First"); }} Public String LastName {get {return LastName; } Set {LastName = value; NotifyPropertyChanged ("Last Name"); }} Private Event PropertyChangedEventHandler PropertyChanged; Private Zero NotifyPropertyChanged (string property name) {var handler = property changed; If (handler! = Null) {handler (this, new property change event event (property name)); }}}}}
note about the answer
with property settings for any For information about recursion and which is the same problem, please see:
first name = value ;
Due to the recurring call to the property setter, do something like this:
Private string first name; Public string first name {get {return firstName;} set {this.firstName = value; /*...*/}}
Comments
Post a Comment