Mercurial > pub > bltoolkit
view Tools/DocGen/Content/Doc/EditableObjects/ManualEditableObject.cs @ 1:8f65451dc28f
Исправлена проблема с фабрикой и выборкой нескольких объектов в linq выражении
author | cin |
---|---|
date | Fri, 28 Mar 2014 01:04:56 +0400 |
parents | f990fcb411a9 |
children |
line wrap: on
line source
public class TestObject : INotifyPropertyChanged { // The FirstName editable property. // private string _originalFirstName; private string _currentFirstName; public override string FirstName { get { return _currentFirstName; } set { _currentFirstName = value; OnPropertyChanged("FirstName"); } } bool IsFirstNameDirty { get { return _currentFirstName != _originalFirstName; } } void AcceptFirstNameChange() { if (IsFirstNameDirty) { _originalFirstName = _currentFirstName; OnPropertyChanged("FirstName"); } } void RejectFirstNameChange() { if (IsFirstNameDirty) { _currentFirstName = _originalFirstName; OnPropertyChanged("FirstName"); } } // The LastName editable property. // private string _originalLastName; private string _currentLastName; public override string LastName { get { return _currentLastName; } set { _currentLastName = value; OnPropertyChanged("LastName"); } } bool IsLastNameDirty { get { return _currentLastName != _originalLastName; } } void AcceptLastNameChange() { if (IsLastNameDirty) { _originalLastName = _currentLastName; OnPropertyChanged("LastName"); } } void RejectLastNameChange() { if (IsLastNameDirty) { _currentLastName = _originalLastName; OnPropertyChanged("LastName"); } } // Common members. // public bool IsDirty { get { return IsFirstNameChange || IsLastNameChange; } } public void AcceptChanges() { AcceptFirstNameChange(); AcceptLastNameChange(); } public void RejectChanges() { RejectFirstNameChange(); RejectLastNameChange(); } public virtual event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } }