1. Create data entity
public class Person:INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private string firstName; private string lastName; private int age; public string FirstName { get { return firstName; } set { firstName = value; OnPropertyChanged("FirstName"); } } public string LastName { get { return lastName; } set { lastName = value; OnPropertyChanged("LastName"); } } public int Age { get { return age; } set { age = value; OnPropertyChanged("Age"); } } private void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } }
2. Define the dataform control, before doing this, you have to add the reference in the application
System.Windows.Controls.Data.DataForm.Toolkit
3. this is the code behind
public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); this.Loaded += new RoutedEventHandler(MainPage_Loaded); } void MainPage_Loaded(object sender, RoutedEventArgs e) { this.DataContext = this; } ObservableCollection