C# Class System.Windows.Controls.ViewModelAttribute

Inheritance: System.Attribute
Afficher le fichier Open project: nikhilk/silverlightfx

Méthodes publiques

Méthode Description
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.

Method Details

CreateViewModel() public static méthode

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.
Résultat object

GetCurrentViewModel() public static méthode

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.
Résultat object

GetViewModel() public static méthode

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.
Résultat object

SetViewModel() public static méthode

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.
Résultat void

ViewModelAttribute() public méthode

Initializes an instance of a ViewModelAttribute.
public ViewModelAttribute ( Type viewModelType ) : System
viewModelType System.Type The type of the associated view model.
Résultat System