Exemplo n.º 1
0
 private void OnPropertyChanged(object sender, PropertyChangedEventArgs args)
 {
     // Sample of strongly typed property changed checking (MyToolkit only)
     if (args.IsProperty<MvvmSamplePageModel>(i => i.DependentProperty))
     {
         // TODO: Add logic for handling DependentProperty change
     }
 }
        /// <summary>Called when a property needs to be validated. </summary>
        /// <param name="sender">The sender. </param>
        /// <param name="args">The arguments. </param>
        protected virtual void OnValidateProperty(object sender, PropertyChangedEventArgs args)
        {
            if (AutoValidateProperties &&
                !args.IsProperty<ValidatedObservableObject>(o => o.HasErrors) &&
                !args.IsProperty<ValidatedObservableObject>(o => o.InvalidProperties) &&
                !args.IsProperty<ValidatedObservableObject>(o => o.InvariantErrors))
            {
                var propertyErrors = ValidateProperty(args.PropertyName);
                SetPropertyErrors(args.PropertyName, propertyErrors);

                var invariantErrors = ValidateInvariants();
                SetPropertyErrors(string.Empty, invariantErrors);
            }
        }
Exemplo n.º 3
0
        private void UndoRedoManagerOnPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            if (args.IsProperty<UndoRedoManager>(i => i.CanUndo))
            {
                UndoCommand.RaiseCanExecuteChanged();

                SaveDocumentCommand.RaiseCanExecuteChanged();
                SaveDocumentAsCommand.RaiseCanExecuteChanged();
            }

            if (args.IsProperty<UndoRedoManager>(i => i.CanRedo))
                RedoCommand.RaiseCanExecuteChanged();
        }