Created
April 29, 2015 21:18
-
-
Save Jalalx/ec38b626cbdbd9d70a24 to your computer and use it in GitHub Desktop.
Unity extensions for WPF Prism apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Microsoft.Practices.Unity | |
{ | |
public static class IUnityContainerExtensions | |
{ | |
/// <summary> | |
/// Registers a ContentControl for navigation using the name parameter. | |
/// </summary> | |
/// <typeparam name="T">The type of ContentControl to register</typeparam> | |
/// <param name="name">The unique name to associate with the registered Page</param> | |
public static void RegisterTypeForNavigation<T>(this IUnityContainer container, string name) | |
{ | |
container.RegisterType(typeof(object), typeof(T), name); | |
} | |
/// <summary> | |
/// Registers a ContentControl for navigation using a convention based approach, using the name of the type being passed in. | |
/// </summary> | |
/// <typeparam name="T">The type of ContentControl to register</typeparam> | |
public static void RegisterTypeForNavigation<T>(this IUnityContainer container) | |
{ | |
Type type = typeof(T); | |
container.RegisterType(typeof(object), type, type.FullName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment