CSLA .NET 10.0.0
A home for your business logic
Loading...
Searching...
No Matches
Csla.Xaml.ViewModel< T > Class Template Reference

Base class used to create ViewModel objects, with pre-existing verbs for use by InvokeMethod or Invoke. More...

Inheritance diagram for Csla.Xaml.ViewModel< T >:
Csla.Xaml.ViewModelBase< T > Csla.Xaml.IViewModel

Public Member Functions

virtual async Task SaveAsync (object sender, ExecuteEventArgs e)
 Saves the Model, first committing changes if ManagedObjectLifetime is true.
virtual void Cancel (object sender, ExecuteEventArgs e)
 Cancels changes made to the model if ManagedObjectLifetime is true.
virtual void AddNew (object sender, ExecuteEventArgs e)
 Adds a new item to the Model (if it is a collection).
virtual void Remove (object sender, ExecuteEventArgs e)
 Removes an item from the Model (if it is a collection).
virtual void Delete (object sender, ExecuteEventArgs e)
 Marks the Model for deletion (if it is an editable root object).
Public Member Functions inherited from Csla.Xaml.ViewModelBase< T >
virtual async Task< T?> RefreshAsync< F > (Func< Task< T?> > factory)
 Creates or retrieves a new instance of the Model by invoking an action.
virtual async Task< T?> SaveAsync ()
 Saves the Model, first committing changes if ManagedObjectLifetime is true.

Additional Inherited Members

Static Public Attributes inherited from Csla.Xaml.ViewModelBase< T >
static readonly DependencyProperty ModelProperty
 Gets or sets the Model object.
static readonly DependencyProperty ManageObjectLifetimeProperty
 Gets or sets a value indicating whether the ViewModel should automatically managed the lifetime of the Model.
Protected Member Functions inherited from Csla.Xaml.ViewModelBase< T >
virtual async Task< T?> DoSaveAsync (ISavable? cloned)
 Override to provide custom Model save behavior.
virtual void DoCancel ()
 Cancels changes made to the model if ManagedObjectLifetime is true.
virtual object DoAddNew ()
 Adds a new item to the Model (if it is a collection).
virtual void DoRemove (object? item)
 Removes an item from the Model (if it is a collection).
virtual void DoDelete ()
 Marks the Model for deletion (if it is an editable root object).
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.
void UnhookChangedEvents (T? model)
 Unhooks changed event handlers from the model.
virtual void OnSetProperties ()
 Override this method to hook into to logic of setting properties when model is changed or edited.
virtual void OnPropertyChanged (string propertyName)
 Raise the PropertyChanged event.
Properties inherited from Csla.Xaml.ViewModelBase< T >
T? Model [get, set]
 Gets or sets the Model object.
bool ManageObjectLifetime [get, set]
 Gets or sets a value indicating whether the ViewManageObjectLifetime should automatically managed the lifetime of the ManageObjectLifetime.
bool IsBusy [get, protected set]
 Gets a value indicating whether this object is executing an asynchronous process.
virtual bool IsDirty [get, protected set]
 Gets a value indicating whether the Model has been changed.
virtual bool IsValid [get, protected set]
 Gets a value indicating whether the Model is currently valid (has no broken rules).
virtual bool CanSave [get, protected set]
 Gets a value indicating whether the Model can currently be saved.
virtual bool CanCancel [get, protected set]
 Gets a value indicating whether the Model can currently be canceled.
virtual bool CanCreate [get, protected set]
 Gets a value indicating whether an instance of the Model can currently be created.
virtual bool CanDelete [get, protected set]
 Gets a value indicating whether the Model can currently be deleted.
virtual bool CanFetch [get, protected set]
 Gets a value indicating whether an instance of the Model can currently be retrieved.
virtual bool CanRemove [get, protected set]
 Gets a value indicating whether the Model can currently be removed.
virtual bool CanAddNew [get, protected set]
 Gets a value indicating whether the Model can currently be added.
virtual bool CanCreateObject [get, protected set]
 Gets a value indicating whether the current user is authorized to create a Model.
virtual bool CanGetObject [get, protected set]
 Gets a value indicating whether the current user is authorized to retrieve a Model.
virtual bool CanEditObject [get, protected set]
 Gets a value indicating whether the current user is authorized to save (insert or update a Model.
virtual bool CanDeleteObject [get, protected set]
 Gets a value indicating whether the current user is authorized to delete a Model.
Events inherited from Csla.Xaml.ViewModelBase< T >
PropertyChangedEventHandler? ModelPropertyChanged
 Event raised when a property on the Model changes.
Action< object, ChildChangedEventArgs >? ModelChildChanged
 Event raised when a child of the Model changes.
Action< object, NotifyCollectionChangedEventArgs >? ModelCollectionChanged
 Event raised the Model changes and is a collection.
PropertyChangedEventHandler? PropertyChanged
 Event raised when a property changes.

Detailed Description

Base class used to create ViewModel objects, with pre-existing verbs for use by InvokeMethod or Invoke.

Template Parameters
TType of the Model object.

Member Function Documentation

◆ AddNew()

virtual void Csla.Xaml.ViewModel< T >.AddNew ( object sender,
ExecuteEventArgs e )
inlinevirtual

Adds a new item to the Model (if it is a collection).

◆ Cancel()

virtual void Csla.Xaml.ViewModel< T >.Cancel ( object sender,
ExecuteEventArgs e )
inlinevirtual

Cancels changes made to the model if ManagedObjectLifetime is true.

◆ Delete()

virtual void Csla.Xaml.ViewModel< T >.Delete ( object sender,
ExecuteEventArgs e )
inlinevirtual

Marks the Model for deletion (if it is an editable root object).

◆ Remove()

virtual void Csla.Xaml.ViewModel< T >.Remove ( object sender,
ExecuteEventArgs e )
inlinevirtual

Removes an item from the Model (if it is a collection).

◆ SaveAsync()

virtual async Task Csla.Xaml.ViewModel< T >.SaveAsync ( object sender,
ExecuteEventArgs e )
inlinevirtual

Saves the Model, first committing changes if ManagedObjectLifetime is true.

Parameters
senderThe source of the event, typically the UI element that triggered the save operation.
eThe ExecuteEventArgs containing event data and parameters for the save operation.
Returns
A Task representing the asynchronous save operation.

The documentation for this class was generated from the following file: