C# Класс System.Windows.Controls.ViewModelAttribute

Наследование: System.Attribute
Показать файл Открыть проект

Открытые методы

Метод Описание
CreateViewModel ( System.Windows.Controls.UserControl userControl ) : object

Creates a view model for the specified view. This uses the view model type specified using a ViewModelAttribute if one is specified, and falls back to convention. The convention locates a type in the same namespace/assembly as the view, with a type name formed by adding the 'Model' or 'ViewModel' suffix to the view's type name.

GetCurrentViewModel ( FrameworkElement element ) : object

Gets the model associated with the specified framework element. This will walk up the parent hierarchy to find a model if the specified element does not have a model.

GetViewModel ( System.Windows.Controls.UserControl userControl ) : object

Gets the view model instance attached to the specified control.

SetViewModel ( System.Windows.Controls.UserControl userControl, object value ) : void

Sets the view model instance attached to the specified control. The view model is also used as the DataContext assigned to the control.

ViewModelAttribute ( Type viewModelType ) : System

Initializes an instance of a ViewModelAttribute.

Описание методов

CreateViewModel() публичный статический Метод

Creates a view model for the specified view. This uses the view model type specified using a ViewModelAttribute if one is specified, and falls back to convention. The convention locates a type in the same namespace/assembly as the view, with a type name formed by adding the 'Model' or 'ViewModel' suffix to the view's type name.
public static CreateViewModel ( System.Windows.Controls.UserControl userControl ) : object
userControl System.Windows.Controls.UserControl The control for which the view model must be created.
Результат object

GetCurrentViewModel() публичный статический Метод

Gets the model associated with the specified framework element. This will walk up the parent hierarchy to find a model if the specified element does not have a model.
public static GetCurrentViewModel ( FrameworkElement element ) : object
element System.Windows.FrameworkElement The element to lookup.
Результат object

GetViewModel() публичный статический Метод

Gets the view model instance attached to the specified control.
public static GetViewModel ( System.Windows.Controls.UserControl userControl ) : object
userControl System.Windows.Controls.UserControl The control to lookup.
Результат object

SetViewModel() публичный статический Метод

Sets the view model instance attached to the specified control. The view model is also used as the DataContext assigned to the control.
public static SetViewModel ( System.Windows.Controls.UserControl userControl, object value ) : void
userControl System.Windows.Controls.UserControl The control to associated the view model with.
value object The view model instance.
Результат void

ViewModelAttribute() публичный Метод

Initializes an instance of a ViewModelAttribute.
public ViewModelAttribute ( Type viewModelType ) : System
viewModelType System.Type The type of the associated view model.
Результат System