Table of Contents

Class ViewAdapter

Namespace
EasySoftware.MvvmMini
Assembly
EasySoftware.MvvmMini.dll

Default IViewAdapter for WPF views. Works with any FrameworkElement; Show(), ShowDialog() and Close() require the view to be a Window.

public class ViewAdapter : IViewAdapter
Inheritance
ViewAdapter
Implements
Inherited Members

Remarks

When the view is a window bound to a ClosableViewModelBase, closing the window calls OnClosing(CancelEventArgs), and a closed window moves the view model to Closed.

Constructors

ViewAdapter(FrameworkElement)

Initializes a new adapter for the given view.

public ViewAdapter(FrameworkElement view)

Parameters

view FrameworkElement

The view to wrap.

Exceptions

ArgumentNullException

view is null.

Properties

DataContext

Gets or sets the data context of the view.

public object DataContext { get; set; }

Property Value

object

View

Gets the wrapped view.

public object View { get; }

Property Value

object

Methods

Close()

Closes the view if it is a Window; otherwise does nothing.

public void Close()

Show()

Shows the view as a non-modal window.

public void Show()

Exceptions

NotSupportedException

The view is not a Window.

ShowDialog()

Shows the view as a modal dialog, owned by the currently active window of the application, and returns when it is closed.

public void ShowDialog()

Exceptions

NotSupportedException

The view is not a Window.

Events

Loaded

Occurs the first time the view is loaded.

public event EventHandler Loaded

Event Type

EventHandler

Unloaded

Occurs when the view is unloaded after it was loaded.

public event EventHandler Unloaded

Event Type

EventHandler