C# Class Catel.MVVM.Providers.UserControlLogic

MVVM Provider behavior implementation for a user control.
Inheritance: LogicBase
Show file Open project: Catel/Catel

Private Properties

Property Type Description
ClearWarningsAndErrorsForObject void
CloseAndDisposeViewModelAsync Task
CreateViewModelWrapper void
GetViewModelResultValueFromUnloadBehavior bool?
OnParentViewModelCancelingAsync Task
OnParentViewModelClosingAsync Task
OnParentViewModelContainerLoading void
OnParentViewModelContainerUnloading void
OnParentViewModelContainerViewModelChanged void
OnParentViewModelSavingAsync Task
OnTargetControlContentChanged void
RegisterViewModelAsChild void
SubscribeToParentViewModel void
SubscribeToParentViewModelContainer void
UnregisterViewModelAsChild void
UnsubscribeFromParentViewModel void
UnsubscribeFromParentViewModelContainer void
UpdateDataContextToUseViewModelAsync Task
UserControlLogic System

Public Methods

Method Description
OnTargetViewDataContextChanged ( object sender, Catel e ) : void

Called when the DataContext property of the TargetView has changed.

OnTargetViewLoadedAsync ( object sender, EventArgs e ) : Task

Called when the TargetView has just been loaded.

OnTargetViewUnloadedAsync ( object sender, EventArgs e ) : Task

Called when the TargetView has just been unloaded.

UserControlLogic ( IView targetView, Type viewModelType = null, IViewModel viewModel = null ) : System

Initializes a new instance of the UserControlLogic class.

Protected Methods

Method Description
OnViewLoadedManagerLoading ( object sender, ViewLoadEventArgs e ) : void

Called when the view manager is loading.

OnViewLoadedManagerUnloading ( object sender, ViewLoadEventArgs e ) : void

Called when the view manager is unloading.

OnViewModelChanged ( ) : void

Called when the LogicBase.ViewModel property has just been changed.

OnViewModelChanging ( ) : void

Called when the LogicBase.ViewModel property is about to change.

SetDataContext ( object newDataContext ) : void

Sets the data context of the target control. This method is abstract because the real logic implementation knows how to set the data context (for example, by using an additional data context grid).

Private Methods

Method Description
ClearWarningsAndErrorsForObject ( object obj ) : void

Clears the warnings and errors for the specified object.

Since there is a "bug" in the .NET Framework (DataContext issue), this method clears the current warnings and errors in the InfoBarMessageControl if available.

CloseAndDisposeViewModelAsync ( bool result ) : Task

Closes and disposes the current view model.

CreateViewModelWrapper ( bool checkIfWrapped = true ) : void

Creates the view model wrapper.

GetViewModelResultValueFromUnloadBehavior ( ) : bool?

Gets the view model result value based on the UnloadBehavior property so it can be used for the CloseAndDisposeViewModelAsync method.

OnParentViewModelCancelingAsync ( object sender, CancelingEventArgs e ) : Task

Handles the Canceling event of the parent ViewModel.

OnParentViewModelClosingAsync ( object sender, EventArgs e ) : Task

Called when Closing event of the parent ViewModel.

OnParentViewModelContainerLoading ( object sender, EventArgs e ) : void
OnParentViewModelContainerUnloading ( object sender, EventArgs e ) : void
OnParentViewModelContainerViewModelChanged ( object sender, EventArgs e ) : void

Handles the ViewModelChanged event of the parent ViewModel container.

OnParentViewModelSavingAsync ( object sender, SavingEventArgs e ) : Task

Handles the Saving event of the parent ViewModel.

OnTargetControlContentChanged ( object sender, PropertyChangedEventArgs e ) : void

Called when the content of the target control has changed.

RegisterViewModelAsChild ( ) : void

Registers the view model as child on the parent view model.

SubscribeToParentViewModel ( IViewModel parentViewModel ) : void

Subscribes to a parent view model.

SubscribeToParentViewModelContainer ( ) : void

Subscribes to the parent view model container.

UnregisterViewModelAsChild ( ) : void

Unregisters the view model as child on the parent view model.

UnsubscribeFromParentViewModel ( ) : void

Unsubscribes from a parent view model.

UnsubscribeFromParentViewModelContainer ( ) : void

Unsubscribes from the parent view model container.

UpdateDataContextToUseViewModelAsync ( object newDataContext ) : Task

Updates the data context to use view model.

UserControlLogic ( ) : System

Initializes static members of the UserControlLogic class.

Method Details

OnTargetViewDataContextChanged() public method

Called when the DataContext property of the TargetView has changed.
public OnTargetViewDataContextChanged ( object sender, Catel e ) : void
sender object The sender.
e Catel The instance containing the event data.
return void

OnTargetViewLoadedAsync() public method

Called when the TargetView has just been loaded.
public OnTargetViewLoadedAsync ( object sender, EventArgs e ) : Task
sender object The sender.
e EventArgs The instance containing the event data.
return Task

OnTargetViewUnloadedAsync() public method

Called when the TargetView has just been unloaded.
public OnTargetViewUnloadedAsync ( object sender, EventArgs e ) : Task
sender object The sender.
e EventArgs The instance containing the event data.
return Task

OnViewLoadedManagerLoading() protected method

Called when the view manager is loading.
protected OnViewLoadedManagerLoading ( object sender, ViewLoadEventArgs e ) : void
sender object The sender.
e ViewLoadEventArgs The instance containing the event data.
return void

OnViewLoadedManagerUnloading() protected method

Called when the view manager is unloading.
protected OnViewLoadedManagerUnloading ( object sender, ViewLoadEventArgs e ) : void
sender object The sender.
e ViewLoadEventArgs The instance containing the event data.
return void

OnViewModelChanged() protected method

Called when the LogicBase.ViewModel property has just been changed.
protected OnViewModelChanged ( ) : void
return void

OnViewModelChanging() protected method

Called when the LogicBase.ViewModel property is about to change.
protected OnViewModelChanging ( ) : void
return void

SetDataContext() protected method

Sets the data context of the target control. This method is abstract because the real logic implementation knows how to set the data context (for example, by using an additional data context grid).
protected SetDataContext ( object newDataContext ) : void
newDataContext object The new data context.
return void

UserControlLogic() public method

Initializes a new instance of the UserControlLogic class.
The is null.
public UserControlLogic ( IView targetView, Type viewModelType = null, IViewModel viewModel = null ) : System
targetView IView The target control.
viewModelType Type Type of the view model.
viewModel IViewModel The view model.
return System