Base class used to create ViewModel objects that implement their own commands/verbs/actions. More...
Public Member Functions | |
| virtual async Task< T > | RefreshAsync< F > (Func< Task< T > > factory) |
| Creates or retrieves a new instance of the Model by invoking an action. More... | |
| virtual async Task< T > | SaveAsync () |
| Saves the Model, first committing changes if ManagedObjectLifetime is true. More... | |
Static Public Attributes | |
| static readonly DependencyProperty | ModelProperty |
| Gets or sets the Model object. More... | |
| static readonly DependencyProperty | ManageObjectLifetimeProperty |
| Gets or sets a value indicating whether the ViewModel should automatically managed the lifetime of the Model. More... | |
Protected Member Functions | |
| virtual void | DoCancel () |
| Cancels changes made to the model if ManagedObjectLifetime is true. More... | |
| virtual object | DoAddNew () |
| Adds a new item to the Model (if it is a collection). More... | |
| virtual void | DoRemove (object item) |
| Removes an item from the Model (if it is a collection). More... | |
| virtual void | DoDelete () |
| Marks the Model for deletion (if it is an editable root object). More... | |
| virtual void | OnModelChanged (T oldValue, T newValue) |
| Invoked when the Model changes, allowing event handlers to be unhooked from the old object and hooked on the new object. More... | |
| void | UnhookChangedEvents (T model) |
| Unhooks changed event handlers from the model. More... | |
| virtual void | OnSetProperties () |
| Override this method to hook into to logic of setting properties when model is changed or edited. More... | |
| virtual void | OnPropertyChanged (string propertyName) |
| Raise the PropertyChanged event. More... | |
Properties | |
| T | Model [getset] |
| Gets or sets the Model object. More... | |
| bool | ManageObjectLifetime [getset] |
| Gets or sets a value indicating whether the ViewManageObjectLifetime should automatically managed the lifetime of the ManageObjectLifetime. More... | |
| bool | IsBusy [getprotected set] |
| Gets a value indicating whether this object is executing an asynchronous process. More... | |
| virtual bool | IsDirty [getprotected set] |
| Gets a value indicating whether the Model has been changed. More... | |
| virtual bool | IsValid [getprotected set] |
| Gets a value indicating whether the Model is currently valid (has no broken rules). More... | |
| virtual bool | CanSave [getprotected set] |
| Gets a value indicating whether the Model can currently be saved. More... | |
| virtual bool | CanCancel [getprotected set] |
| Gets a value indicating whether the Model can currently be canceled. More... | |
| virtual bool | CanCreate [getprotected set] |
| Gets a value indicating whether an instance of the Model can currently be created. More... | |
| virtual bool | CanDelete [getprotected set] |
| Gets a value indicating whether the Model can currently be deleted. More... | |
| virtual bool | CanFetch [getprotected set] |
| Gets a value indicating whether an instance of the Model can currently be retrieved. More... | |
| virtual bool | CanRemove [getprotected set] |
| Gets a value indicating whether the Model can currently be removed. More... | |
| virtual bool | CanAddNew [getprotected set] |
| Gets a value indicating whether the Model can currently be added. More... | |
| virtual bool | CanCreateObject [getprotected set] |
| Gets a value indicating whether the current user is authorized to create a Model. More... | |
| virtual bool | CanGetObject [getprotected set] |
| Gets a value indicating whether the current user is authorized to retrieve a Model. More... | |
| virtual bool | CanEditObject [getprotected set] |
| Gets a value indicating whether the current user is authorized to save (insert or update a Model. More... | |
| virtual bool | CanDeleteObject [getprotected set] |
| Gets a value indicating whether the current user is authorized to delete a Model. More... | |
Properties inherited from Csla.Xaml.IViewModel | |
| object | Model [getset] |
| Gets or sets the Model property of the viewmodel object. More... | |
Events | |
| PropertyChangedEventHandler | PropertyChanged |
| Event raised when a property changes. More... | |
Base class used to create ViewModel objects that implement their own commands/verbs/actions.
| T | Type of the Model object. |
Definition at line 37 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
protectedvirtual |
Adds a new item to the Model (if it is a collection).
Definition at line 633 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
protectedvirtual |
Cancels changes made to the model if ManagedObjectLifetime is true.
Definition at line 583 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
protectedvirtual |
Marks the Model for deletion (if it is an editable root object).
Definition at line 666 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
protectedvirtual |
Removes an item from the Model (if it is a collection).
Definition at line 656 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
protectedvirtual |
Invoked when the Model changes, allowing event handlers to be unhooked from the old object and hooked on the new object.
| oldValue | Previous Model reference. |
| newValue | New Model reference. |
Definition at line 678 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
protectedvirtual |
Raise the PropertyChanged event.
| propertyName | Name of the changed property. |
Definition at line 787 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
protectedvirtual |
Override this method to hook into to logic of setting properties when model is changed or edited.
Definition at line 742 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
virtual |
Creates or retrieves a new instance of the Model by invoking an action.
| factory | Factory method to invoke |
Definition at line 531 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
virtual |
Saves the Model, first committing changes if ManagedObjectLifetime is true.
Definition at line 551 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
protected |
Unhooks changed event handlers from the model.
| model |
Definition at line 710 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
static |
Gets or sets a value indicating whether the ViewModel should automatically managed the lifetime of the Model.
Definition at line 92 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
static |
Gets or sets the Model object.
Definition at line 66 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the Model can currently be added.
Definition at line 319 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the Model can currently be canceled.
Definition at line 207 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether an instance of the Model can currently be created.
Definition at line 230 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the current user is authorized to create a Model.
Definition at line 415 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the Model can currently be deleted.
Definition at line 252 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the current user is authorized to delete a Model.
Definition at line 486 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the current user is authorized to save (insert or update a Model.
Definition at line 462 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether an instance of the Model can currently be retrieved.
Definition at line 275 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the current user is authorized to retrieve a Model.
Definition at line 438 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the Model can currently be removed.
Definition at line 297 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the Model can currently be saved.
Definition at line 185 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether this object is executing an asynchronous process.
Definition at line 121 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the Model has been changed.
Definition at line 141 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getprotected set |
Gets a value indicating whether the Model is currently valid (has no broken rules).
Definition at line 163 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getset |
Gets or sets a value indicating whether the ViewManageObjectLifetime should automatically managed the lifetime of the ManageObjectLifetime.
Definition at line 104 of file Csla.Xaml.Shared/ViewModelBase.cs.
|
getset |
Gets or sets the Model object.
Definition at line 77 of file Csla.Xaml.Shared/ViewModelBase.cs.
| PropertyChangedEventHandler Csla.Xaml.ViewModelBase< T >.PropertyChanged |
Event raised when a property changes.
Definition at line 781 of file Csla.Xaml.Shared/ViewModelBase.cs.