Class ViewModelBase<T>
Base class for all exported view models.
Inheritance
Namespace: Phoenix.Views
Assembly: Phoenix.Abstractions.Views.dll
Syntax
public abstract class ViewModelBase<T> : BindableBase, IViewProvider, IClosingNotification, IViewInitialize where T : FrameworkElement
Type Parameters
Name | Description |
---|---|
T | The type of the View this model is for. |
Constructors
View SourceViewModelBase(T, IWindowingControl, IEventAggregator, IPhoenixLogger, IServiceProvider)
Initializes a new instance of the ViewModelBase<T> class.
Declaration
protected ViewModelBase(T view, IWindowingControl windowingControl, IEventAggregator eventAggregator, IPhoenixLogger logger, IServiceProvider services = null)
Parameters
Type | Name | Description |
---|---|---|
T | view | The view this view model is driving. |
IWindowingControl | windowingControl | |
IEventAggregator | eventAggregator | The event aggregator for the application. |
IPhoenixLogger | logger | The logger for the application. |
System.IServiceProvider | services | The services for the view. |
ViewModelBase(T, String, IWindowingControl, IEventAggregator, IPhoenixLogger, IServiceProvider)
Initializes a new instance of the ViewModelBase<T> class.
Declaration
protected ViewModelBase(T view, string headerName, IWindowingControl windowingControl, IEventAggregator eventAggregator, IPhoenixLogger logger, IServiceProvider services = null)
Parameters
Type | Name | Description |
---|---|---|
T | view | The view this view model is driving. |
System.String | headerName | The name of the view for display in the window manager. |
IWindowingControl | windowingControl | |
IEventAggregator | eventAggregator | The event aggregator for the application. |
IPhoenixLogger | logger | The logger for the application. |
System.IServiceProvider | services |
Properties
View SourceEventAggregator
Gets the event aggregator for this view model.
Declaration
protected IEventAggregator EventAggregator { get; }
Property Value
Type | Description |
---|---|
IEventAggregator |
HeaderName
Gets or sets the name of this view for display in the window manager.
Declaration
public string HeaderName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IsClosable
Gets or sets a value indicating whether the view can be closed by the user.
Declaration
public bool IsClosable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsDockable
Gets or sets a value indicating whether the window can be docked and undocked by the user.
Declaration
public bool IsDockable { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Logger
Gets the logger for this view model.
Declaration
protected IPhoenixLogger Logger { get; }
Property Value
Type | Description |
---|---|
IPhoenixLogger |
View
Gets the view this view model is backing.
Declaration
public T View { get; }
Property Value
Type | Description |
---|---|
T |
Methods
View SourceCloseView()
Closes this view using the window manager.
Declaration
protected void CloseView()
Closing(CancelEventArgs)
Called when the IClosingListener is closing.
Declaration
public void Closing(CancelEventArgs eventArgs)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.CancelEventArgs | eventArgs | A System.ComponentModel.CancelEventArgs that contains the event data. |
Initialize()
Allows derived classes to initialize after imports are satisfied.
Declaration
protected virtual void Initialize()
OnClosed()
Called when the IClosingListener is closed.
Declaration
protected virtual void OnClosed()
OnClosing(CancelEventArgs)
Called when the IClosingListener is closing.
Declaration
protected virtual void OnClosing(CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.CancelEventArgs | e | A System.ComponentModel.CancelEventArgs that contains the event data. |
Uninitialize()
Allows derived classes to uninitialize before the view is closed.
Declaration
protected virtual void Uninitialize()
Events
View SourceClosed
Occurs when the view model is closed.
Declaration
public event EventHandler Closed
Event Type
Type | Description |
---|---|
System.EventHandler |
Explicit Interface Implementations
View SourceIClosingNotification.Closed(EventArgs)
Called when the IClosingListener is closed.
Declaration
void IClosingNotification.Closed(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
IViewInitialize.Initialize()
Declaration
void IViewInitialize.Initialize()
IViewInitialize.Uninitialize()
Declaration
void IViewInitialize.Uninitialize()
IViewProvider.View
Gets the view for this view provider.
Declaration
FrameworkElement IViewProvider.View { get; }
Returns
Type | Description |
---|---|
System.Windows.FrameworkElement |