Skip to end of metadata
Go to start of metadata

Represents an advanced collection view controller with built-in MVVM and data binding support.

Definition

public class UICollectionViewController<TViewModel> : UICollectionViewController,

ICollectionViewController, INavigationContext, IViewNotification, IViewModelInitializer,

IServiceAccessor, ISupportItemBinding

where TViewModel : IViewModel, class

Type Parameters

TViewModel

Summary

The following table summarizes the members exposed in this class.

Public Constructors

Public Properties

CellIdentifier Gets the cell identifier.
CellImageSettings Gets the cell image settings.
CellTemplate Gets the cell template.
CollectionSource Gets or sets the collection source.
EditingOptions Gets the editing options.
EnterEditModeOnLongPress Gets a value indicating whether the view controller should enter edit mode when user performs long press on an item.
FilteredCollectionSource Gets or sets the filtered collection source.
FitItemSizeToSuperview Gets a value indicating whether the collection view and its item size should be resized to fit the bounds of its superview.
ImageLoaderSettings Gets the image loader settings.
InteractionMode Gets the interaction mode.
ItemBindingAdapters Gets the item binding adapters for this table view.
PreferredItemSize When UICollectionViewController<TViewModel> is used, gets the preferred item dimension based on the scroll direction of the collection view.
SearchDisplayController Gets the search display controller.
SectionFooterTemplate Gets the section footer template.
SectionHeaderTemplate Gets the section header template.
ShowSectionHeader Gets a value indicating whether the view controller should display section header.
TitleMemberPath Gets the property member path for Title binding.
ViewLayout Gets the view layout.
ViewModel Gets the view model associated to this instance.

Protected Properties

LoadedFromNib Gets or sets a value indicating whether this UICollectionViewController<TViewModel> is loaded from nib.

Public Methods

AddBinding(BindingContext) Adds binding from an existing binding context.
AddBinding(NSObject, BindableProperty, BindingDescription) Adds binding to the target view.
AddBinding(NSObject, BindableProperty, string) Adds binding to the target view with the specified path.
AddBinding(NSObject, 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.
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.
PrepareForSegue(UIStoryboardSegue, NSObject) Prepares for storyboard segue.
RegisterItemBindingAdapter<TView, TAdapter>() Registers the item binding adapter for the specified view type.
RegisterViewIdentifier(string, NSObject) Registers the specified identifier to the view.
SetEditing(bool, bool) Sets the editing mode.
ShouldPerformSegue(string, NSObject) Determines whether the segue should be performed.
ValueForKey(NSString) Gets the value of the associated key.
ValueForUndefinedKey(NSString) Called when the given key is undefined.
ViewDidAppear(bool) Called when the view has appeared on the screen.
ViewDidDisappear(bool) Called when the view has disappeared from the screen.
ViewDidLayoutSubviews() Called when the sub views have been laid out.
ViewDidLoad() Called when the view is loaded to the view controller.
ViewWillAppear(bool) Called when the view is about to become visible.
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.
GetItemBinding() Gets the item binding description.
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.
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 UICollectionViewController()

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

public UICollectionViewController(IntPtr handle)

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

Parameters

handle Handle.

public UICollectionViewController(string nibName, NSBundle bundle)

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

Parameters

nibName Nib name.
bundle Bundle.

public UICollectionViewController(TViewModel viewModel)

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

Parameters

viewModel View model.

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

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

Parameters

nibName Nib name.
bundle Bundle.
viewModel View model.

Public Properties

public string CellIdentifier { get; }

Gets the cell identifier.

public ImageSettings CellImageSettings { get; }

Gets the cell image settings.

public UIViewTemplate CellTemplate { get; }

Gets the cell template.

public UICollectionViewSource CollectionSource { get; set; }

Gets or sets the collection source.

public EditingOptions EditingOptions { get; }

Gets the editing options.

public bool EnterEditModeOnLongPress { get; }

Gets a value indicating whether the view controller should enter edit mode when user performs long press on an item.

public UICollectionViewSource FilteredCollectionSource { get; set; }

Gets or sets the filtered collection source.

public bool FitItemSizeToSuperview { get; }

Gets a value indicating whether the collection view and its item size should be resized to fit the bounds of its superview.

public BasicImageLoaderSettings ImageLoaderSettings { get; }

Gets the image loader settings.

public CollectionViewInteraction InteractionMode { get; }

Gets the interaction mode.

public Dictionary<Type, IItemBindingAdapter> ItemBindingAdapters { get; }

Gets the item binding adapters for this table view.

public CGSize PreferredItemSize { get; }

When UICollectionViewController<TViewModel> is used, gets the preferred item dimension based on the scroll direction of the collection view.

public UISearchDisplayController SearchDisplayController { get; }

Gets the search display controller.

public UIViewTemplate SectionFooterTemplate { get; }

Gets the section footer template.

public UIViewTemplate SectionHeaderTemplate { get; }

Gets the section header template.

public bool ShowSectionHeader { get; }

Gets a value indicating whether the view controller should display section header.

public string TitleMemberPath { get; }

Gets the property member path for Title binding.

public UICollectionViewLayout ViewLayout { get; }

Gets the view layout.

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 UICollectionViewController<TViewModel> is loaded from nib.

Public Methods

public void AddBinding(BindingContext bindingContext)

Adds binding from an existing binding context.

Parameters

bindingContext Binding context.

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

Adds binding to the target view.

Parameters

targetView Target view.
property Property.
binding Binding.

public void AddBinding(NSObject 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(NSObject 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 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 PrepareForSegue(UIStoryboardSegue segue, NSObject sender)

Prepares for storyboard segue.

Parameters

segue Segue.
sender Sender.

public void RegisterItemBindingAdapter<TView, TAdapter>()

Registers the item binding adapter for the specified view type.

Type Parameters

TView The view type.
TAdapter The adapter type.

public void RegisterViewIdentifier(string id, NSObject view)

Registers the specified identifier to the view.

Parameters

id Identifier.
view View.

public void SetEditing(bool editing, bool animated)

Sets the editing mode.

Parameters

editing If set to true editing.
animated If set to true animated.

public bool ShouldPerformSegue(string segueIdentifier, NSObject sender)

Determines whether the segue should be performed.

Parameters

segueIdentifier Segue identifier.
sender Sender.

Return Types

true, if the segue should be performed, false otherwise.

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 ViewDidAppear(bool animated)

Called when the view has appeared on the screen.

Parameters

animated If set to true animated.

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 sub views have 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 is about to become visible.

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 ItemBindingDescription GetItemBinding()

Gets the item binding description.

Return Types

The item binding.

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 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