Class RegionManagerExtensions
Class that creates a fluent interface for the IRegionManager class, with respect to adding views to regions (View Injection pattern), registering view types to regions (View Discovery pattern)
Inheritance
Namespace: Sartorius.SAF.Presentation.Regions
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public static class RegionManagerExtensions
Methods
View SourceAdd(IRegionCollection, String, IRegion)
Adds a region to the region manager with the name received as argument.
Declaration
public static void Add(this IRegionCollection regionCollection, string regionName, IRegion region)
Parameters
Type | Name | Description |
---|---|---|
IRegionCollection | regionCollection | The region manager's collection of regions. |
System.String | regionName | The name to be given to the region. |
IRegion | region | The region to be added to the region manager. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
System.ArgumentException | Thrown if |
AttachNewRegion(IRegionManager, DependencyObject, String)
Attaches a new Region to the RegionManager
Declaration
public static void AttachNewRegion(this IRegionManager regionManager, DependencyObject regionTarget, string regionName)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | A implementation of IRegionManager |
System.Windows.DependencyObject | regionTarget | The target DependencyProperty to set region to |
System.String | regionName | The name of the new region |
RegisterViewWithRegion(IRegionManager, String, Func<Object>)
Associate a view with a region, using a delegate to resolve a concrete instance of the view. When the region get's displayed, this delegate will be called and the result will be added to the views collection of the region.
Declaration
public static IRegionManager RegisterViewWithRegion(this IRegionManager regionManager, string regionName, Func<object> getContentDelegate)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | The region manager that this extension method effects. |
System.String | regionName | The name of the region to associate the view with. |
System.Func<System.Object> | getContentDelegate | The delegate used to resolve a concrete instance of the view. |
Returns
Type | Description |
---|---|
IRegionManager | The region manager, for adding several views easily |
RegisterViewWithRegion(IRegionManager, String, Type)
Associate a view with a region, by registering a type. When the region get's displayed this type will be resolved using the ServiceLocator into a concrete instance. The instance will be added to the Views collection of the region
Declaration
public static IRegionManager RegisterViewWithRegion(this IRegionManager regionManager, string regionName, Type viewType)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | The region manager that this extension method effects. |
System.String | regionName | The name of the region to associate the view with. |
System.Type | viewType | The type of the view to register with the |
Returns
Type | Description |
---|---|
IRegionManager | The region manager, for adding several views easily |
RegisterViewWithRegion<TView, TViewModel>(IRegionManager, String)
Associate a view with a region, by registering a type. When the region get's displayed this type will be resolved using the ServiceLocator into a concrete instance. The instance will be added to the Views collection of the region
Declaration
public static IRegionManager RegisterViewWithRegion<TView, TViewModel>(this IRegionManager regionManager, string regionName)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | The region manager that this extension method effects. |
System.String | regionName | The name of the region to associate the view with. |
Returns
Type | Description |
---|---|
IRegionManager | The region manager, for adding several views easily |
Type Parameters
Name | Description |
---|---|
TView | |
TViewModel |
RequestNavigate(IRegionManager, String, String)
Navigates the specified region manager.
Declaration
public static void RequestNavigate(this IRegionManager regionManager, string regionName, string source)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | The region manager that this extension method effects. |
System.String | regionName | The name of the region to call Navigate on. |
System.String | source | The URI of the content to display. |
RequestNavigate(IRegionManager, String, String, Action<NavigationResult>)
Navigates the specified region manager.
Declaration
public static void RequestNavigate(this IRegionManager regionManager, string regionName, string source, Action<NavigationResult> navigationCallback)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | The region manager that this extension method effects. |
System.String | regionName | The name of the region to call Navigate on. |
System.String | source | The URI of the content to display. |
System.Action<NavigationResult> | navigationCallback | The navigation callback. |
RequestNavigate(IRegionManager, String, Uri)
Navigates the specified region manager.
Declaration
public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri source)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | The region manager that this extension method effects. |
System.String | regionName | The name of the region to call Navigate on. |
System.Uri | source | The URI of the content to display. |
RequestNavigate(IRegionManager, String, Uri, Action<NavigationResult>)
Navigates the specified region manager.
Declaration
public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri source, Action<NavigationResult> navigationCallback)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | The region manager that this extension method effects. |
System.String | regionName | The name of the region to call Navigate on. |
System.Uri | source | The URI of the content to display. |
System.Action<NavigationResult> | navigationCallback | The navigation callback. |
RequestNavigate<T>(IRegionManager, String)
Extension to RequestNavigate Method of IRegionManager
Declaration
public static void RequestNavigate<T>(this IRegionManager regionManager, string regionName)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | A implementation of IRegionManager |
System.String | regionName | The name of the new region |
Type Parameters
Name | Description |
---|---|
T | the Type to navigate to |
RequestNavigate<T>(IRegionManager, String, Action<NavigationResult>)
Extension to RequestNavigate Method of IRegionManager
Declaration
public static void RequestNavigate<T>(this IRegionManager regionManager, string regionName, Action<NavigationResult> navigationCallBack)
Parameters
Type | Name | Description |
---|---|---|
IRegionManager | regionManager | A implementation of IRegionManager |
System.String | regionName | The name of the new region |
System.Action<NavigationResult> | navigationCallBack |
Type Parameters
Name | Description |
---|---|
T | the Type to navigate to |