Skip to content

Instantly share code, notes, and snippets.

@rohits79
Created June 8, 2016 00:46
Show Gist options
  • Save rohits79/3cec96ea5860901f3d46b3268ab20731 to your computer and use it in GitHub Desktop.
Save rohits79/3cec96ea5860901f3d46b3268ab20731 to your computer and use it in GitHub Desktop.
/// <summary>
/// Configures the default region adapter mappings to use in the application, in order
/// to adapt UI controls defined in XAML to use a region and register it automatically.
/// May be overwritten in a derived class to add specific mappings required by the application.
/// </summary>
/// <returns>The <see cref="RegionAdapterMappings"/> instance containing all the mappings.</returns>
protected virtual RegionAdapterMappings ConfigureRegionAdapterMappings()
{
RegionAdapterMappings regionAdapterMappings = ServiceLocator.Current.GetInstance<RegionAdapterMappings>();
if (regionAdapterMappings != null)
{
regionAdapterMappings.RegisterMapping(typeof(Selector), ServiceLocator.Current.GetInstance<SelectorRegionAdapter>());
regionAdapterMappings.RegisterMapping(typeof(ItemsControl), ServiceLocator.Current.GetInstance<ItemsControlRegionAdapter>());
regionAdapterMappings.RegisterMapping(typeof(ContentControl), ServiceLocator.Current.GetInstance<ContentControlRegionAdapter>());
}
return regionAdapterMappings;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment