Skip to end of metadata
Go to start of metadata

Represents an advanced UIViewController with built-in MVVM and data binding support.

Definition

public class UIViewController<TViewModel> : UIViewController,

ISupportVisualEffect, INavigationContext, IViewController, IViewNotification,

IViewModelInitializer, IServiceAccessor

where TViewModel : IViewModel, class

Type Parameters

TViewModel

Summary

The following table summarizes the members exposed in this class.

Public Constructors

Public Properties

AutoDispose Gets or sets a value indicating whether this UIViewController<TViewModel> will be automatically disposed when it's no longer used.
AutoFitContentSize Gets a value indicating whether the content should be automatically resized to fit the available screen real estate.
AutoScrollToVisible Gets a value indicating whether the view should automatically scroll to the visible element, particularly when users focus on a text input which area was covered by keyboard.
BlurEffectStyle Gets the blur effect style, when the UIViewController<TViewModel> property value is true.
EnableBlurEffect Gets a value indicating whether the blur effect should be applied to this view controller.
HideKeyboardOnTap Gets a value indicating whether the keyboard should be automatically hidden when user tapped anywhere on the screen.
IsActive Gets or sets a value indicating whether this instance is active.
TitleMemberPath Gets the property member path for Title binding.
ViewModel Gets the view model associated to this instance.

Protected Properties

LoadedFromNib Gets or sets a value indicating whether this UIViewController<TViewModel> loaded from nib.
ShouldRegisterBindings Gets a value whether the view controller should perform binding registration.

Public Methods

AddBinding(BindingContext) Adds binding from an existing binding context.
AddBinding(UIView, BindableProperty, BindingDescription) Adds binding to the target view.
AddBinding(UIView, BindableProperty, string) Adds binding to the target view with the specified path.
AddBinding(UIView, BindableProperty, string, BindingMode) Adds binding to the target view with the specified path and mpode.
AddBinding(string, BindableProperty, BindingDescription) Adds binding to the target view with the specified binding description.
AddBinding(string, BindableProperty, string) Adds binding to the target view name with the specified path.
AddBinding(string, BindableProperty, string, BindingMode) Adds binding to the target view name with the specified path and mode.
AddChildViewController(UIViewController) Adds the child view controller.
AddStaticView(UIView, CGPoint) Adds a statically-positioned view to the scroll view.
DetermineNavigationMode(NavigationParameter) Determines the navigation mode based on the given parameter.
DidReceiveMemoryWarning() Called when the system is running low on memory.
FindName(string) Finds a view with the specified name.
FindName<T>(string) Finds a view with the specified name.
GetService<TService>() Gets the registered service based on the specified type parameter.
GetService<TService>(bool) Gets the service and optionally return a new instance of the service.
RegisterViewIdentifier(string, NSObject) Registers the specified identifier to the view.
SetToolbarHidden(bool, bool) Sets the visibility of the toolbar.
ValueForKey(NSString) Gets the value of the associated key.
ValueForUndefinedKey(NSString) Called when the given key is undefined.
ViewDidDisappear(bool) Called when the view has disappeared from the screen.
ViewDidLayoutSubviews() Called when the subviews managed by this controller has been laid out.
ViewDidLoad() Called when the view is loaded to the view controller.
ViewWillAppear(bool) Called when the view will appear.
ViewWillDisappear(bool) Called when the view is about to disappear from the screen.

Protected Methods

CreateViewModel() Called when the view model for this controller needs to be created.
Dispose(bool) Dispose this instance.
InitializeBindings() Called when the bindings are being initialized.
InitializeView() Called when the view is in initialization cycle.
InitializeViewModel() Called when the view model is being initialized.
OnKeyboardChanged(bool, float) Called when the keyboard state is changed.
OnViewCreated() Called when the view is created.
OnViewDismissed(NavigationResult) Called when the view is dismissed.
OnViewDisposed() Called when the view is disposed.
OnViewInitialized() Called when the view has been completely initialized.
OnViewModelPropertyChanged(PropertyChangedEventArgs) Called when the properties of the associated ViewModel has changed.
OnViewModelResourcesChanged() Called when the localization resources in the underlying ViewModel have changed.

Events

ViewDismissed Occurs when view dismissed.

Public Constructors

public UIViewController()

Initializes a new instance of the UIViewController<TViewModel> class.

public UIViewController(IntPtr handle)

Initializes a new instance of the UIViewController<TViewModel> class.

Parameters

handle Handle.

public UIViewController(TViewModel viewModel)

Initializes a new instance of the UIViewController<TViewModel> class with the specified view model.

Parameters

viewModel View model.

public UIViewController(string nibName, NSBundle bundle)

Initializes a new instance of the UIViewController<TViewModel> class.

Parameters

nibName Nib name.
bundle Bundle.

public UIViewController(string nibName, NSBundle bundle, TViewModel viewModel)

Initializes a new instance of the UIViewController<TViewModel> class.

Parameters

nibName Nib name.
bundle Bundle.
viewModel View model.

Public Properties

public bool AutoDispose { get; set; }

Gets or sets a value indicating whether this UIViewController<TViewModel> will be automatically disposed when it's no longer used.

public bool AutoFitContentSize { get; }

Gets a value indicating whether the content should be automatically resized to fit the available screen real estate.

public bool AutoScrollToVisible { get; }

Gets a value indicating whether the view should automatically scroll to the visible element, particularly when users focus on a text input which area was covered by keyboard.

public UIBlurEffectStyle BlurEffectStyle { get; }

Gets the blur effect style, when the UIViewController<TViewModel> property value is true.

public bool EnableBlurEffect { get; }

Gets a value indicating whether the blur effect should be applied to this view controller.

public bool HideKeyboardOnTap { get; }

Gets a value indicating whether the keyboard should be automatically hidden when user tapped anywhere on the screen.

public bool IsActive { get; }

Gets or sets a value indicating whether this instance is active.

public string TitleMemberPath { get; }

Gets the property member path for Title binding.

public TViewModel ViewModel { get; }

Gets the view model associated to this instance.

Protected Properties

protected bool LoadedFromNib { get; set; }

Gets or sets a value indicating whether this UIViewController<TViewModel> loaded from nib.

protected bool ShouldRegisterBindings { get; }

Gets a value whether the view controller should perform binding registration.

Public Methods

public void AddBinding(BindingContext bindingContext)

Adds binding from an existing binding context.

Parameters

bindingContext Binding context.

public void AddBinding(UIView targetView, BindableProperty property, BindingDescription binding)

Adds binding to the target view.

Parameters

targetView Target view.
property Property.
binding Binding.

public void AddBinding(UIView targetView, BindableProperty property, string path)

Adds binding to the target view with the specified path.

Parameters

targetView Target view.
property Property.
path Path.

public void AddBinding(UIView targetView, BindableProperty property, string path, BindingMode mode)

Adds binding to the target view with the specified path and mpode.

Parameters

targetView Target view.
property Property.
path Path.
mode Mode.

public void AddBinding(string targetViewName, BindableProperty property, BindingDescription binding)

Adds binding to the target view with the specified binding description.

Parameters

targetViewName Target view name.
property Property.
binding Binding.

public void AddBinding(string targetViewName, BindableProperty property, string path)

Adds binding to the target view name with the specified path.

Parameters

targetViewName Target view name.
property Property.
path Path.

public void AddBinding(string targetViewName, BindableProperty property, string path, BindingMode mode)

Adds binding to the target view name with the specified path and mode.

Parameters

targetViewName Target view name.
property Property.
path Path.
mode Mode.

public void AddChildViewController(UIViewController childController)

Adds the child view controller.

Parameters

childController Child controller.

public void AddStaticView(UIView view, CGPoint position)

Adds a statically-positioned view to the scroll view.

Parameters

view View.
position Position.

public void DetermineNavigationMode(NavigationParameter parameter)

Determines the navigation mode based on the given parameter.

Parameters

parameter Navigation parameter.

public void DidReceiveMemoryWarning()

Called when the system is running low on memory.

public object FindName(string name)

Finds a view with the specified name.

Parameters

name Name.

Return Types

The name.

public T FindName<T>(string name)

Finds a view with the specified name.

Type Parameters

T The 1st type parameter.

Parameters

name Name.

Return Types

The name.

public TService GetService<TService>()

Gets the registered service based on the specified type parameter.

Type Parameters

TService The service type to retrieve.

Return Types

The service.

public TService GetService<TService>(bool newInstance)

Gets the service and optionally return a new instance of the service.

Type Parameters

TService The 1st type parameter.

Parameters

newInstance If set to true new instance.

Return Types

The service.

public void RegisterViewIdentifier(string id, NSObject view)

Registers the specified identifier to the view.

Parameters

id Identifier.
view View.

public void SetToolbarHidden(bool hidden, bool animated)

Sets the visibility of the toolbar.

Parameters

hidden If set to true, the toolbar will be hidden.
animated If set to true, the toolbar visibility changes will be animated.

public NSObject ValueForKey(NSString key)

Gets the value of the associated key.

Parameters

key Key.

Return Types

The object corresponding to the given key.

public NSObject ValueForUndefinedKey(NSString key)

Called when the given key is undefined.

Parameters

key Key.

public void ViewDidDisappear(bool animated)

Called when the view has disappeared from the screen.

Parameters

animated If set to true animated.

public void ViewDidLayoutSubviews()

Called when the subviews managed by this controller has been laid out.

public void ViewDidLoad()

Called when the view is loaded to the view controller.

public void ViewWillAppear(bool animated)

Called when the view will appear.

Parameters

animated If set to true animated.

public void ViewWillDisappear(bool animated)

Called when the view is about to disappear from the screen.

Parameters

animated If set to true animated.

Protected Methods

protected TViewModel CreateViewModel()

Called when the view model for this controller needs to be created.

Return Types

The view model.

protected void Dispose(bool disposing)

Dispose this instance.

Parameters

disposing If set to true disposing.

protected void InitializeBindings()

Called when the bindings are being initialized.

protected void InitializeView()

Called when the view is in initialization cycle.

protected void InitializeViewModel()

Called when the view model is being initialized.

protected void OnKeyboardChanged(bool visible, float height)

Called when the keyboard state is changed.

Parameters

visible If set to true visible.
height Height.

protected void OnViewCreated()

Called when the view is created.

protected void OnViewDismissed(NavigationResult result)

Called when the view is dismissed.

Parameters

result Result.

protected void OnViewDisposed()

Called when the view is disposed.

protected void OnViewInitialized()

Called when the view has been completely initialized.

protected void OnViewModelPropertyChanged(PropertyChangedEventArgs e)

Called when the properties of the associated ViewModel has changed.

Parameters

e The event argument.

protected void OnViewModelResourcesChanged()

Called when the localization resources in the underlying ViewModel have changed.

Events

public event EventHandler<DismissViewEventArgs> ViewDismissed

Occurs when view dismissed.

  • No labels