Created
April 19, 2011 14:04
-
-
Save ElemarJR/927930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace SilverlightApplication1 | |
{ | |
public partial class MainPage : UserControl | |
{ | |
public MainPage() | |
{ | |
InitializeComponent(); | |
this.Loaded += (s, e) => { this.DataContext = new Person(); }; | |
} | |
} | |
public class Person : INotifyPropertyChanged | |
{ | |
string NameField; | |
public string Name { | |
get | |
{ | |
return this.NameField; | |
} | |
set | |
{ | |
if (value.Length < 10) throw new Exception("Erro!"); | |
this.NameField = value; | |
if (this.PropertyChanged != null) | |
this.PropertyChanged(this, new PropertyChangedEventArgs("Name")); | |
} | |
} | |
public event PropertyChangedEventHandler PropertyChanged; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment