提交 87af17bd 编写于 作者: D Dan Siegel

chore: migrate namespace to Prism.Navigation.Regions

上级 7398d7cc
using Prism.Regions; using Prism.Navigation.Regions;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using Prism.Regions; using Prism.Navigation.Regions;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using Prism.Regions; using Prism.Navigation.Regions;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using Prism.Regions; using Prism.Navigation.Regions;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using Prism.Regions; using Prism.Navigation.Regions;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
...@@ -3,7 +3,7 @@ using System.Threading.Tasks; ...@@ -3,7 +3,7 @@ using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using Prism.Commands; using Prism.Commands;
using Prism.Navigation; using Prism.Navigation;
using Prism.Regions.Navigation; using Prism.Navigation.Regions.Navigation;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using Prism.Regions.Navigation; using Prism.Navigation.Regions.Navigation;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using Prism.Regions.Navigation; using Prism.Navigation.Regions.Navigation;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
...@@ -2,8 +2,8 @@ using System; ...@@ -2,8 +2,8 @@ using System;
using Prism.Commands; using Prism.Commands;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Navigation; using Prism.Navigation;
using Prism.Regions; using Prism.Navigation.Regions;
using Prism.Regions.Navigation; using Prism.Navigation.Regions.Navigation;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using Prism.Regions; using Prism.Navigation.Regions;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using Prism.Regions; using Prism.Navigation.Regions;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
using System; using System;
using Prism.Commands; using Prism.Commands;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Regions.Navigation; using Prism.Navigation.Regions.Navigation;
namespace HelloRegions.ViewModels namespace HelloRegions.ViewModels
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using HelloWorld.Core; using HelloWorld.Core;
using Prism.Commands; using Prism.Commands;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Regions; using Prism.Navigation.Regions;
using Prism.Dialogs; using Prism.Dialogs;
namespace HelloWorld.ViewModels namespace HelloWorld.ViewModels
...@@ -35,7 +35,7 @@ namespace HelloWorld.ViewModels ...@@ -35,7 +35,7 @@ namespace HelloWorld.ViewModels
{ {
_dialogService = dialogService; _dialogService = dialogService;
_regionManager = regionManager; _regionManager = regionManager;
ShowDialogCommand = new DelegateCommand(ShowDialog); ShowDialogCommand = new DelegateCommand(ShowDialog);
} }
private void ShowDialog() private void ShowDialog()
......
using System; using System;
using Prism.Ioc; using Prism.Ioc;
using Prism.Regions; using Prism.Navigation.Regions;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Behaviors namespace Prism.Behaviors
......
using System; using System;
using Prism.Regions; using Prism.Navigation.Regions;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Common namespace Prism.Common
......
using System; using System;
using Prism.Regions; using Prism.Navigation.Regions;
using Prism.Regions.Adapters; using Prism.Navigation.Regions.Adapters;
using Prism.Regions.Behaviors; using Prism.Navigation.Regions.Behaviors;
using Prism.Regions.Navigation; using Prism.Navigation.Regions.Navigation;
using Prism.Navigation.Regions;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Ioc namespace Prism.Ioc
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Prism.Navigation; using Prism.Navigation;
using Prism.Regions; using Prism.Navigation.Regions;
using Prism.Navigation.Regions;
namespace Prism.Ioc namespace Prism.Ioc
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Linq; using System.Linq;
using Prism.Behaviors; using Prism.Behaviors;
using Prism.Common; using Prism.Common;
using Prism.Ioc; using Prism.Ioc;
using Prism.Navigation;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
using Prism.Regions.Navigation;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Adapters namespace Prism.Navigation.Regions.Adapters
{ {
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its /// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its
......
using System; using System;
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Adapters namespace Prism.Navigation.Regions.Adapters
{ {
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="Region"/> and monitors its /// Adapter that creates a new <see cref="Region"/> and monitors its
......
...@@ -3,10 +3,9 @@ using System.Collections.Specialized; ...@@ -3,10 +3,9 @@ using System.Collections.Specialized;
using System.Linq; using System.Linq;
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Adapters namespace Prism.Navigation.Regions.Adapters
{ {
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its /// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
using System.Linq; using System.Linq;
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Adapters namespace Prism.Navigation.Regions.Adapters
{ {
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="Region"/> and monitors its /// Adapter that creates a new <see cref="Region"/> and monitors its
......
using System; using System;
using System.Globalization; using System.Globalization;
using Prism.Navigation.Regions.Behaviors;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Adapters namespace Prism.Navigation.Regions.Adapters
{ {
/// <summary> /// <summary>
/// Base class to facilitate the creation of <see cref="IRegionAdapter"/> implementations. /// Base class to facilitate the creation of <see cref="IRegionAdapter"/> implementations.
......
...@@ -4,7 +4,7 @@ using System.Globalization; ...@@ -4,7 +4,7 @@ using System.Globalization;
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions.Adapters namespace Prism.Navigation.Regions.Adapters
{ {
/// <summary> /// <summary>
/// This class maps <see cref="Type"/> with <see cref="IRegionAdapter"/>. /// This class maps <see cref="Type"/> with <see cref="IRegionAdapter"/>.
......
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Adapters namespace Prism.Navigation.Regions.Adapters
{ {
// Implementation Note: // Implementation Note:
// In discussing with PureWeen, it is best to provide a ContentView and provide a // In discussing with PureWeen, it is best to provide a ContentView and provide a
......
...@@ -3,10 +3,9 @@ using System.Collections.Specialized; ...@@ -3,10 +3,9 @@ using System.Collections.Specialized;
using System.Linq; using System.Linq;
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Adapters namespace Prism.Navigation.Regions.Adapters
{ {
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="Region"/> and monitors its /// Adapter that creates a new <see cref="Region"/> and monitors its
......
using System; using System;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Region that keeps all the views in it as active. Deactivation of views is not allowed. /// Region that keeps all the views in it as active. Deactivation of views is not allowed.
......
...@@ -4,7 +4,7 @@ using System.ComponentModel; ...@@ -4,7 +4,7 @@ using System.ComponentModel;
using Prism.Ioc; using Prism.Ioc;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Populates the target region with the views registered to it in the <see cref="IRegionViewRegistry"/>. /// Populates the target region with the views registered to it in the <see cref="IRegionViewRegistry"/>.
......
...@@ -4,10 +4,10 @@ using System.ComponentModel; ...@@ -4,10 +4,10 @@ using System.ComponentModel;
using Prism.Common; using Prism.Common;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Defines a behavior that forwards the <see cref="Xaml.RegionManager.RegionContextProperty"/> /// Defines a behavior that forwards the <see cref="Xaml.RegionManager.RegionContextProperty"/>
/// to the views in the region. /// to the views in the region.
/// </summary> /// </summary>
public class BindRegionContextToVisualElementBehavior : IRegionBehavior public class BindRegionContextToVisualElementBehavior : IRegionBehavior
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using System.Linq; using System.Linq;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Behavior that removes the RegionManager attached property of all the views in a region once the RegionManager property of a region becomes null. /// Behavior that removes the RegionManager attached property of all the views in a region once the RegionManager property of a region becomes null.
...@@ -35,7 +35,7 @@ namespace Prism.Regions.Behaviors ...@@ -35,7 +35,7 @@ namespace Prism.Regions.Behaviors
if (target == null) if (target == null)
throw new ArgumentNullException(nameof(target)); throw new ArgumentNullException(nameof(target));
return (bool)target.GetValue(ClearChildViewsRegionBehavior.ClearChildViewsProperty); return (bool)target.GetValue(ClearChildViewsProperty);
} }
/// <summary> /// <summary>
...@@ -48,7 +48,7 @@ namespace Prism.Regions.Behaviors ...@@ -48,7 +48,7 @@ namespace Prism.Regions.Behaviors
if (target == null) if (target == null)
throw new ArgumentNullException(nameof(target)); throw new ArgumentNullException(nameof(target));
target.SetValue(ClearChildViewsRegionBehavior.ClearChildViewsProperty, value); target.SetValue(ClearChildViewsProperty, value);
} }
/// <summary> /// <summary>
...@@ -56,7 +56,7 @@ namespace Prism.Regions.Behaviors ...@@ -56,7 +56,7 @@ namespace Prism.Regions.Behaviors
/// </summary> /// </summary>
protected override void OnAttach() protected override void OnAttach()
{ {
this.Region.PropertyChanged += Region_PropertyChanged; Region.PropertyChanged += Region_PropertyChanged;
} }
private static void ClearChildViews(IRegion region) private static void ClearChildViews(IRegion region)
...@@ -74,9 +74,9 @@ namespace Prism.Regions.Behaviors ...@@ -74,9 +74,9 @@ namespace Prism.Regions.Behaviors
{ {
if (e.PropertyName == "RegionManager") if (e.PropertyName == "RegionManager")
{ {
if (this.Region.RegionManager == null) if (Region.RegionManager == null)
{ {
ClearChildViews(this.Region); ClearChildViews(Region);
} }
} }
} }
......
...@@ -5,11 +5,11 @@ using System.ComponentModel; ...@@ -5,11 +5,11 @@ using System.ComponentModel;
using System.Globalization; using System.Globalization;
using Prism.Behaviors; using Prism.Behaviors;
using Prism.Extensions; using Prism.Extensions;
using Prism.Navigation.Regions.Adapters;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Adapters;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Behavior that creates a new <see cref="IRegion"/>, when the control that will host the <see cref="IRegion"/> (see <see cref="TargetElement"/>) /// Behavior that creates a new <see cref="IRegion"/>, when the control that will host the <see cref="IRegion"/> (see <see cref="TargetElement"/>)
...@@ -99,7 +99,7 @@ namespace Prism.Regions.Behaviors ...@@ -99,7 +99,7 @@ namespace Prism.Regions.Behaviors
/// Called when the <see cref="IRegionManager"/> is updating it's <see cref="IRegionManager.Regions"/> collection. /// Called when the <see cref="IRegionManager"/> is updating it's <see cref="IRegionManager.Regions"/> collection.
/// </summary> /// </summary>
/// <param name="sender">The <see cref="IRegionManager"/>. </param> /// <param name="sender">The <see cref="IRegionManager"/>. </param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
public void OnUpdatingRegions(object sender, EventArgs e) public void OnUpdatingRegions(object sender, EventArgs e)
{ {
TryCreateRegion(); TryCreateRegion();
...@@ -153,7 +153,7 @@ namespace Prism.Regions.Behaviors ...@@ -153,7 +153,7 @@ namespace Prism.Regions.Behaviors
page.Behaviors.Add(cleanupBehavior); page.Behaviors.Add(cleanupBehavior);
if (region is INavigationServiceAware nsa) if (region is INavigationServiceAware nsa)
{ {
nsa.NavigationService = Prism.Navigation.Xaml.Navigation.GetNavigationService(page); nsa.NavigationService = global::Prism.Navigation.Xaml.Navigation.GetNavigationService(page);
} }
return region; return region;
......
using System.Collections.Specialized; using System.Collections.Specialized;
using Prism.Common; using Prism.Common;
using Prism.Navigation;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Provides a Behavior to Destroy the View/ViewModel when the View is removed from the Region's Views /// Provides a Behavior to Destroy the View/ViewModel when the View is removed from the Region's Views
......
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Defines a <see cref="IRegionBehavior"/> that not allows extensible behaviors on regions which also interact /// Defines a <see cref="IRegionBehavior"/> that not allows extensible behaviors on regions which also interact
......
...@@ -4,17 +4,17 @@ using System.Linq; ...@@ -4,17 +4,17 @@ using System.Linq;
using Prism.Common; using Prism.Common;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Behavior that monitors a <see cref="IRegion"/> object and /// Behavior that monitors a <see cref="IRegion"/> object and
/// changes the value for the <see cref="IActiveAware.IsActive"/> property when /// changes the value for the <see cref="IActiveAware.IsActive"/> property when
/// an object that implements <see cref="IActiveAware"/> gets added or removed /// an object that implements <see cref="IActiveAware"/> gets added or removed
/// from the collection. /// from the collection.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This class can also sync the active state for any scoped regions directly on the view based on the <see cref="SyncActiveStateAttribute"/>. /// This class can also sync the active state for any scoped regions directly on the view based on the <see cref="SyncActiveStateAttribute"/>.
/// If you use the <see cref="Prism.Regions.Region.Add(VisualElement,string,bool)" /> method with the createRegionManagerScope option, the scoped manager will be attached to the view. /// If you use the <see cref="Regions.Region.Add(VisualElement,string,bool)" /> method with the createRegionManagerScope option, the scoped manager will be attached to the view.
/// </remarks> /// </remarks>
public class RegionActiveAwareBehavior : IRegionBehavior public class RegionActiveAwareBehavior : IRegionBehavior
{ {
...@@ -33,7 +33,7 @@ namespace Prism.Regions.Behaviors ...@@ -33,7 +33,7 @@ namespace Prism.Regions.Behaviors
/// </summary> /// </summary>
public void Attach() public void Attach()
{ {
INotifyCollectionChanged collection = this.GetCollection(); INotifyCollectionChanged collection = GetCollection();
if (collection != null) if (collection != null)
{ {
collection.CollectionChanged += OnCollectionChanged; collection.CollectionChanged += OnCollectionChanged;
...@@ -45,7 +45,7 @@ namespace Prism.Regions.Behaviors ...@@ -45,7 +45,7 @@ namespace Prism.Regions.Behaviors
/// </summary> /// </summary>
public void Detach() public void Detach()
{ {
INotifyCollectionChanged collection = this.GetCollection(); INotifyCollectionChanged collection = GetCollection();
if (collection != null) if (collection != null)
{ {
collection.CollectionChanged -= OnCollectionChanged; collection.CollectionChanged -= OnCollectionChanged;
...@@ -82,13 +82,13 @@ namespace Prism.Regions.Behaviors ...@@ -82,13 +82,13 @@ namespace Prism.Regions.Behaviors
{ {
if (item is VisualElement visualElement) if (item is VisualElement visualElement)
{ {
// We are assuming that any scoped region managers are attached directly to the // We are assuming that any scoped region managers are attached directly to the
// view. // view.
var regionManager = Xaml.RegionManager.GetRegionManager(visualElement); var regionManager = Xaml.RegionManager.GetRegionManager(visualElement);
// If the view's RegionManager attached property is different from the region's RegionManager, // If the view's RegionManager attached property is different from the region's RegionManager,
// then the view's region manager is a scoped region manager. // then the view's region manager is a scoped region manager.
if (regionManager == null || regionManager == this.Region.RegionManager) return; if (regionManager == null || regionManager == Region.RegionManager) return;
var activeViews = regionManager.Regions.SelectMany(e => e.ActiveViews).OfType<VisualElement>(); var activeViews = regionManager.Regions.SelectMany(e => e.ActiveViews).OfType<VisualElement>();
...@@ -115,7 +115,7 @@ namespace Prism.Regions.Behaviors ...@@ -115,7 +115,7 @@ namespace Prism.Regions.Behaviors
private INotifyCollectionChanged GetCollection() private INotifyCollectionChanged GetCollection()
{ {
return this.Region.ActiveViews; return Region.ActiveViews;
} }
} }
} }
...@@ -3,7 +3,7 @@ using System.ComponentModel; ...@@ -3,7 +3,7 @@ using System.ComponentModel;
using Prism.Properties; using Prism.Properties;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Subscribes to a static event from the <see cref="RegionManager"/> in order to register the target <see cref="IRegion"/> /// Subscribes to a static event from the <see cref="RegionManager"/> in order to register the target <see cref="IRegion"/>
......
...@@ -5,7 +5,7 @@ using System.Linq; ...@@ -5,7 +5,7 @@ using System.Linq;
using Prism.Common; using Prism.Common;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// The RegionMemberLifetimeBehavior determines if items should be removed from the <see cref="IRegion"/> /// The RegionMemberLifetimeBehavior determines if items should be removed from the <see cref="IRegion"/>
...@@ -13,10 +13,10 @@ namespace Prism.Regions.Behaviors ...@@ -13,10 +13,10 @@ namespace Prism.Regions.Behaviors
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// The <see cref="RegionMemberLifetimeBehavior"/> monitors the <see cref="IRegion.ActiveViews"/> /// The <see cref="RegionMemberLifetimeBehavior"/> monitors the <see cref="IRegion.ActiveViews"/>
/// collection to discover items that transition into a deactivated state. /// collection to discover items that transition into a deactivated state.
/// <p/> /// <p/>
/// The behavior checks the removed items for either the <see cref="IRegionMemberLifetime"/> /// The behavior checks the removed items for either the <see cref="IRegionMemberLifetime"/>
/// or the <see cref="RegionMemberLifetimeAttribute"/> (in that order) to determine if it should be kept /// or the <see cref="RegionMemberLifetimeAttribute"/> (in that order) to determine if it should be kept
/// alive on removal. /// alive on removal.
/// <p/> /// <p/>
/// If the item in the collection is a <see cref="VisualElement"/>, it will /// If the item in the collection is a <see cref="VisualElement"/>, it will
......
...@@ -3,14 +3,14 @@ using Prism.Common; ...@@ -3,14 +3,14 @@ using Prism.Common;
using Prism.Properties; using Prism.Properties;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Behaviors namespace Prism.Navigation.Regions.Behaviors
{ {
/// <summary> /// <summary>
/// Behavior that synchronizes the <see cref="IRegion.Context"/> property of a <see cref="IRegion"/> with /// Behavior that synchronizes the <see cref="IRegion.Context"/> property of a <see cref="IRegion"/> with
/// the control that hosts the Region. It does this by setting the <see cref="Xaml.RegionManager.RegionContextProperty"/> /// the control that hosts the Region. It does this by setting the <see cref="Xaml.RegionManager.RegionContextProperty"/>
/// Dependency Property on the host control. /// Dependency Property on the host control.
/// ///
/// This behavior allows the usage of two way databinding of the RegionContext from XAML. /// This behavior allows the usage of two way databinding of the RegionContext from XAML.
/// </summary> /// </summary>
public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegionBehavior public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegionBehavior
{ {
...@@ -18,7 +18,7 @@ namespace Prism.Regions.Behaviors ...@@ -18,7 +18,7 @@ namespace Prism.Regions.Behaviors
private VisualElement _hostControl; private VisualElement _hostControl;
/// <summary> /// <summary>
/// Name that identifies the SyncRegionContextWithHostBehavior behavior in a collection of RegionsBehaviors. /// Name that identifies the SyncRegionContextWithHostBehavior behavior in a collection of RegionsBehaviors.
/// </summary> /// </summary>
public static readonly string BehaviorKey = "SyncRegionContextWithHost"; public static readonly string BehaviorKey = "SyncRegionContextWithHost";
...@@ -54,7 +54,7 @@ namespace Prism.Regions.Behaviors ...@@ -54,7 +54,7 @@ namespace Prism.Regions.Behaviors
{ {
if (HostControl != null) if (HostControl != null)
{ {
// Sync values initially. // Sync values initially.
SynchronizeRegionContext(); SynchronizeRegionContext();
// Now register for events to keep them in sync // Now register for events to keep them in sync
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using Prism.Ioc; using Prism.Ioc;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
internal class DefaultRegionManagerAccessor : IRegionManagerAccessor internal class DefaultRegionManagerAccessor : IRegionManagerAccessor
{ {
......
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
internal interface IActiveRegionHelper internal interface IActiveRegionHelper
{ {
......
using Prism.Navigation; namespace Prism.Navigation.Regions
namespace Prism.Regions
{ {
internal interface INavigationServiceAware internal interface INavigationServiceAware
{ {
......
using System; using System;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Provides an abstraction on top of the RegionManager static members. /// Provides an abstraction on top of the RegionManager static members.
...@@ -19,7 +19,7 @@ namespace Prism.Regions ...@@ -19,7 +19,7 @@ namespace Prism.Regions
/// Gets the value for the RegionName attached property. /// Gets the value for the RegionName attached property.
/// </summary> /// </summary>
/// <param name="element">The object to adapt. This is typically a container (i.e a control).</param> /// <param name="element">The object to adapt. This is typically a container (i.e a control).</param>
/// <returns>The name of the region that should be created when /// <returns>The name of the region that should be created when
/// the RegionManager is also set in this element.</returns> /// the RegionManager is also set in this element.</returns>
string GetRegionName(VisualElement element); string GetRegionName(VisualElement element);
......
using System; using System;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Defines a class that wraps an item and adds metadata for it. /// Defines a class that wraps an item and adds metadata for it.
......
...@@ -8,7 +8,7 @@ using Prism.Ioc.Internals; ...@@ -8,7 +8,7 @@ using Prism.Ioc.Internals;
using Prism.Properties; using Prism.Properties;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Navigation namespace Prism.Navigation.Regions.Navigation
{ {
/// <summary> /// <summary>
/// Implementation of <see cref="IRegionNavigationContentLoader"/> that relies on a <see cref="IContainerProvider"/> /// Implementation of <see cref="IRegionNavigationContentLoader"/> that relies on a <see cref="IContainerProvider"/>
......
...@@ -2,12 +2,10 @@ ...@@ -2,12 +2,10 @@
using System.Linq; using System.Linq;
using Prism.Common; using Prism.Common;
using Prism.Ioc; using Prism.Ioc;
using Prism.Navigation;
using Prism.Properties; using Prism.Properties;
using Prism.Regions;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Navigation namespace Prism.Navigation.Regions.Navigation
{ {
/// <summary> /// <summary>
/// Provides navigation for regions. /// Provides navigation for regions.
......
...@@ -4,11 +4,10 @@ using System.Globalization; ...@@ -4,11 +4,10 @@ using System.Globalization;
using System.Linq; using System.Linq;
using Prism.Ioc; using Prism.Ioc;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Navigation;
using Prism.Properties; using Prism.Properties;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Implementation of <see cref="IRegion"/> that allows multiple active views. /// Implementation of <see cref="IRegion"/> that allows multiple active views.
......
...@@ -6,7 +6,7 @@ using System.Globalization; ...@@ -6,7 +6,7 @@ using System.Globalization;
using System.Linq; using System.Linq;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
internal class RegionCollection : IRegionCollection internal class RegionCollection : IRegionCollection
{ {
...@@ -66,7 +66,7 @@ namespace Prism.Regions ...@@ -66,7 +66,7 @@ namespace Prism.Regions
} }
_regions.Add(region); _regions.Add(region);
region.RegionManager = this.regionManager; region.RegionManager = regionManager;
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, region, 0)); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, region, 0));
} }
......
using System; using System;
using Prism.Common; using Prism.Common;
using Prism.Regions.Behaviors; using Prism.Navigation.Regions.Behaviors;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Class that holds methods to Set and Get the RegionContext from a BindableObject. /// Class that holds methods to Set and Get the RegionContext from a BindableObject.
......
...@@ -4,11 +4,10 @@ using System.Threading; ...@@ -4,11 +4,10 @@ using System.Threading;
using Prism.Common; using Prism.Common;
using Prism.Ioc; using Prism.Ioc;
using Prism.Ioc.Internals; using Prism.Ioc.Internals;
using Prism.Navigation;
using Prism.Properties; using Prism.Properties;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// This class is responsible for maintaining a collection of regions and attaching regions to controls. /// This class is responsible for maintaining a collection of regions and attaching regions to controls.
......
using System.Linq; using System.Linq;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Region that allows a maximum of one active view at a time. /// Region that allows a maximum of one active view at a time.
......
...@@ -7,7 +7,7 @@ using System.Linq; ...@@ -7,7 +7,7 @@ using System.Linq;
using Prism.Mvvm; using Prism.Mvvm;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Implementation of <see cref="IViewsCollection"/> that takes an <see cref="ObservableCollection{T}"/> of <see cref="ItemMetadata"/> /// Implementation of <see cref="IViewsCollection"/> that takes an <see cref="ObservableCollection{T}"/> of <see cref="ItemMetadata"/>
...@@ -83,7 +83,7 @@ namespace Prism.Regions ...@@ -83,7 +83,7 @@ namespace Prism.Regions
///</returns> ///</returns>
IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator()
{ {
return this.GetEnumerator(); return GetEnumerator();
} }
/// <summary> /// <summary>
...@@ -125,12 +125,12 @@ namespace Prism.Regions ...@@ -125,12 +125,12 @@ namespace Prism.Regions
/// </summary> /// </summary>
private void RemoveAllMetadataMonitors() private void RemoveAllMetadataMonitors()
{ {
foreach (var item in this._monitoredItems) foreach (var item in _monitoredItems)
{ {
item.Key.MetadataChanged -= this.OnItemMetadataChanged; item.Key.MetadataChanged -= OnItemMetadataChanged;
} }
this._monitoredItems.Clear(); _monitoredItems.Clear();
} }
/// <summary> /// <summary>
...@@ -174,7 +174,7 @@ namespace Prism.Regions ...@@ -174,7 +174,7 @@ namespace Prism.Regions
bool foundInfo = _monitoredItems.TryGetValue(itemMetadata, out MonitorInfo monitorInfo); bool foundInfo = _monitoredItems.TryGetValue(itemMetadata, out MonitorInfo monitorInfo);
if (!foundInfo) return; if (!foundInfo) return;
if (this.Filter(itemMetadata)) if (Filter(itemMetadata))
{ {
if (!monitorInfo.IsInList) if (!monitorInfo.IsInList)
{ {
...@@ -182,7 +182,7 @@ namespace Prism.Regions ...@@ -182,7 +182,7 @@ namespace Prism.Regions
// as in our list so we can consider this // as in our list so we can consider this
// an Add. // an Add.
monitorInfo.IsInList = true; monitorInfo.IsInList = true;
this.UpdateFilteredItemsList(); UpdateFilteredItemsList();
NotifyAdd(itemMetadata.Item); NotifyAdd(itemMetadata.Item);
} }
} }
...@@ -192,7 +192,7 @@ namespace Prism.Regions ...@@ -192,7 +192,7 @@ namespace Prism.Regions
// tracking list, but should not remove any monitoring in // tracking list, but should not remove any monitoring in
// case it fits our filter in the future. // case it fits our filter in the future.
monitorInfo.IsInList = false; monitorInfo.IsInList = false;
this.RemoveFromFilteredList(itemMetadata.Item); RemoveFromFilteredList(itemMetadata.Item);
} }
} }
...@@ -218,11 +218,11 @@ namespace Prism.Regions ...@@ -218,11 +218,11 @@ namespace Prism.Regions
} }
// If we're sorting we can't predict how // If we're sorting we can't predict how
// the collection has changed on an add so we // the collection has changed on an add so we
// resort to a reset notification. // resort to a reset notification.
if (SortComparison != null) if (SortComparison != null)
{ {
this.NotifyReset(); NotifyReset();
} }
break; break;
...@@ -230,19 +230,19 @@ namespace Prism.Regions ...@@ -230,19 +230,19 @@ namespace Prism.Regions
case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Remove:
foreach (ItemMetadata itemMetadata in e.OldItems) foreach (ItemMetadata itemMetadata in e.OldItems)
{ {
this.RemoveMetadataMonitor(itemMetadata); RemoveMetadataMonitor(itemMetadata);
if (this.Filter(itemMetadata)) if (Filter(itemMetadata))
{ {
this.RemoveFromFilteredList(itemMetadata.Item); RemoveFromFilteredList(itemMetadata.Item);
} }
} }
break; break;
default: default:
this.ResetAllMonitors(); ResetAllMonitors();
this.UpdateFilteredItemsList(); UpdateFilteredItemsList();
this.NotifyReset(); NotifyReset();
break; break;
} }
...@@ -283,12 +283,12 @@ namespace Prism.Regions ...@@ -283,12 +283,12 @@ namespace Prism.Regions
public override int Compare(VisualElement x, VisualElement y) public override int Compare(VisualElement x, VisualElement y)
{ {
if (this.comparer == null) if (comparer == null)
{ {
return 0; return 0;
} }
return this.comparer(x, y); return comparer(x, y);
} }
} }
......
...@@ -4,12 +4,12 @@ using System.Reflection; ...@@ -4,12 +4,12 @@ using System.Reflection;
using Prism.Common; using Prism.Common;
using Prism.Events; using Prism.Events;
using Prism.Ioc; using Prism.Ioc;
using Prism.Navigation.Regions.Adapters;
using Prism.Navigation.Regions.Behaviors;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Adapters;
using Prism.Regions.Behaviors;
using Xamarin.Forms; using Xamarin.Forms;
namespace Prism.Regions.Xaml namespace Prism.Navigation.Regions.Xaml
{ {
/// <summary> /// <summary>
/// A class to provide Bindable Properties and helpers for Regions. /// A class to provide Bindable Properties and helpers for Regions.
......
...@@ -13,13 +13,13 @@ Prism.Forms.Regions helps you more easily design and build rich, flexible, and e ...@@ -13,13 +13,13 @@ Prism.Forms.Regions helps you more easily design and build rich, flexible, and e
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\..\Wpf\Prism.Wpf\Regions\RegionViewRegistry.cs" Link="Regions\%(Filename)%(Extension)" /> <Compile Include="..\..\Wpf\Prism.Wpf\Navigation\Regions\RegionViewRegistry.cs" Link="Navigation\Regions\%(Filename)%(Extension)" />
<Compile Include="..\..\Wpf\Prism.Wpf\Regions\*Exception.cs" Link="Regions\%(Filename)%(Extension)" /> <Compile Include="..\..\Wpf\Prism.Wpf\Navigation\Regions\*Exception.cs" Link="Regions\%(Filename)%(Extension)" />
<Compile Include="..\..\Wpf\Prism.Wpf\Regions\*Exception.Desktop.cs" Link="Regions\%(Filename)%(Extension)" /> <Compile Include="..\..\Wpf\Prism.Wpf\Navigation\Regions\*Exception.Desktop.cs" Link="Navigation\Regions\%(Filename)%(Extension)" />
<Compile Include="..\..\Wpf\Prism.Wpf\Regions\Behaviors\*Exception.cs" Link="Regions\Behaviors\%(Filename)%(Extension)" /> <Compile Include="..\..\Wpf\Prism.Wpf\Navigation\Regions\Behaviors\*Exception.cs" Link="Navigation\Regions\Behaviors\%(Filename)%(Extension)" />
<Compile Include="..\..\Wpf\Prism.Wpf\Regions\Behaviors\*Exception.Desktop.cs" Link="Regions\Behaviors\%(Filename)%(Extension)" /> <Compile Include="..\..\Wpf\Prism.Wpf\Navigation\Regions\Behaviors\*Exception.Desktop.cs" Link="Navigation\Regions\Behaviors\%(Filename)%(Extension)" />
<Compile Remove="..\..\Wpf\Prism.Wpf\Regions\Behaviors\RegionCreationException.cs" /> <Compile Remove="..\..\Wpf\Prism.Wpf\Navigation\Regions\Behaviors\RegionCreationException.cs" />
<Compile Remove="..\..\Wpf\Prism.Wpf\Regions\Behaviors\RegionCreationException.Desktop.cs" /> <Compile Remove="..\..\Wpf\Prism.Wpf\Navigation\Regions\Behaviors\RegionCreationException.Desktop.cs" />
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
......
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Xamarin.Forms; using Xamarin.Forms;
[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Regions.Xaml")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Navigation.Regions.Xaml")]
[assembly: InternalsVisibleTo("Prism.Forms.Regions.Tests")] [assembly: InternalsVisibleTo("Prism.Forms.Regions.Tests")]
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
using System.Reflection; using System.Reflection;
using Prism.Navigation; using Prism.Navigation;
using Prism.Navigation.Xaml; using Prism.Navigation.Xaml;
using Prism.Regions; using Prism.Navigation.Regions;
using Prism.Regions.Navigation;
using NavigationMode = Prism.Navigation.NavigationMode; using NavigationMode = Prism.Navigation.NavigationMode;
using TabbedPage = Microsoft.Maui.Controls.TabbedPage; using TabbedPage = Microsoft.Maui.Controls.TabbedPage;
......
using Microsoft.Maui.Controls.Compatibility; using Microsoft.Maui.Controls.Compatibility;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Regions; using Prism.Navigation.Regions;
using Prism.Regions.Adapters; using Prism.Navigation.Regions.Adapters;
using Prism.Regions.Behaviors; using Prism.Navigation.Regions.Behaviors;
using Prism.Regions.Navigation; using Prism.Navigation.Regions.Navigation;
using Prism.Navigation.Regions;
namespace Prism.Ioc; namespace Prism.Ioc;
...@@ -19,7 +20,7 @@ public static class RegionNavigationRegistrationExtensions ...@@ -19,7 +20,7 @@ public static class RegionNavigationRegistrationExtensions
/// <param name="containerRegistry"><see cref="IContainerRegistry"/> used to register type for Navigation.</param> /// <param name="containerRegistry"><see cref="IContainerRegistry"/> used to register type for Navigation.</param>
/// <param name="name">The unique name to register with the View</param> /// <param name="name">The unique name to register with the View</param>
public static IContainerRegistry RegisterForRegionNavigation<TView>(this IContainerRegistry containerRegistry, string name = null) public static IContainerRegistry RegisterForRegionNavigation<TView>(this IContainerRegistry containerRegistry, string name = null)
where TView : View => where TView : View =>
containerRegistry.RegisterForNavigationWithViewModel(typeof(TView), null, name); containerRegistry.RegisterForNavigationWithViewModel(typeof(TView), null, name);
/// <summary> /// <summary>
...@@ -31,7 +32,7 @@ public static class RegionNavigationRegistrationExtensions ...@@ -31,7 +32,7 @@ public static class RegionNavigationRegistrationExtensions
/// <param name="containerRegistry"></param> /// <param name="containerRegistry"></param>
public static IContainerRegistry RegisterForRegionNavigation<TView, TViewModel>(this IContainerRegistry containerRegistry, string name = null) public static IContainerRegistry RegisterForRegionNavigation<TView, TViewModel>(this IContainerRegistry containerRegistry, string name = null)
where TView : View where TView : View
where TViewModel : class => where TViewModel : class =>
containerRegistry.RegisterForNavigationWithViewModel(typeof(TView), typeof(TViewModel), name); containerRegistry.RegisterForNavigationWithViewModel(typeof(TView), typeof(TViewModel), name);
private static IContainerRegistry RegisterForNavigationWithViewModel(this IContainerRegistry containerRegistry, Type viewType, Type viewModelType, string name) private static IContainerRegistry RegisterForNavigationWithViewModel(this IContainerRegistry containerRegistry, Type viewType, Type viewModelType, string name)
...@@ -41,7 +42,7 @@ public static class RegionNavigationRegistrationExtensions ...@@ -41,7 +42,7 @@ public static class RegionNavigationRegistrationExtensions
if (viewModelType is not null) if (viewModelType is not null)
containerRegistry.Register(viewModelType); containerRegistry.Register(viewModelType);
containerRegistry.Register(viewType) containerRegistry.Register(viewType)
.RegisterInstance(new ViewRegistration .RegisterInstance(new ViewRegistration
{ {
......
using System.Collections; using System.Collections;
using Prism.Regions; using Prism.Navigation.Regions;
namespace Prism.Navigation.Internals; namespace Prism.Navigation.Internals;
......
...@@ -4,10 +4,8 @@ using Prism.Common; ...@@ -4,10 +4,8 @@ using Prism.Common;
using Prism.Ioc; using Prism.Ioc;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
using Prism.Regions.Navigation;
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its /// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its
...@@ -114,7 +112,7 @@ public class CarouselViewRegionAdapter : RegionAdapterBase<CarouselView> ...@@ -114,7 +112,7 @@ public class CarouselViewRegionAdapter : RegionAdapterBase<CarouselView>
} }
var name = newActiveView.GetValue(ViewModelLocator.NavigationNameProperty) as string; var name = newActiveView.GetValue(ViewModelLocator.NavigationNameProperty) as string;
if(string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
{ {
var viewType = newActiveView.GetType(); var viewType = newActiveView.GetType();
var registry = _region.Container().Resolve<IRegionNavigationRegistry>(); var registry = _region.Container().Resolve<IRegionNavigationRegistry>();
......
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="Region"/> and monitors its /// Adapter that creates a new <see cref="Region"/> and monitors its
......
using Prism.Ioc; namespace Prism.Navigation.Regions.Adapters;
using Prism.Regions.Behaviors;
namespace Prism.Regions.Adapters;
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its /// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its
......
using System.Collections.Specialized; using System.Collections.Specialized;
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its /// Adapter that creates a new <see cref="SingleActiveRegion"/> and monitors its
......
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
/// <summary> /// <summary>
/// Defines an interfaces to adapt an object and bind it to a new <see cref="IRegion"/>. /// Defines an interfaces to adapt an object and bind it to a new <see cref="IRegion"/>.
......
using Microsoft.Maui.Controls.Compatibility; using Microsoft.Maui.Controls.Compatibility;
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="Region"/> and monitors its /// Adapter that creates a new <see cref="Region"/> and monitors its
......
using System.Globalization; using System.Globalization;
using Prism.Extensions; using Prism.Extensions;
using Prism.Ioc; using Prism.Ioc;
using Prism.Navigation.Regions.Behaviors;
using Prism.Navigation.Xaml; using Prism.Navigation.Xaml;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
using XamlNavigation = Prism.Navigation.Xaml.Navigation;
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
/// <summary> /// <summary>
/// Base class to facilitate the creation of <see cref="IRegionAdapter"/> implementations. /// Base class to facilitate the creation of <see cref="IRegionAdapter"/> implementations.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
/// <summary> /// <summary>
/// This class maps <see cref="Type"/> with <see cref="IRegionAdapter"/>. /// This class maps <see cref="Type"/> with <see cref="IRegionAdapter"/>.
......
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
// Implementation Note: // Implementation Note:
// In discussing with PureWeen, it is best to provide a ContentView and provide a // In discussing with PureWeen, it is best to provide a ContentView and provide a
......
using System.Collections.Specialized; using System.Collections.Specialized;
using Prism.Ioc; using Prism.Ioc;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Behaviors;
namespace Prism.Regions.Adapters; namespace Prism.Navigation.Regions.Adapters;
/// <summary> /// <summary>
/// Adapter that creates a new <see cref="Region"/> and monitors its /// Adapter that creates a new <see cref="Region"/> and monitors its
...@@ -57,4 +56,4 @@ public class ScrollViewRegionAdapter : RegionAdapterBase<ScrollView> ...@@ -57,4 +56,4 @@ public class ScrollViewRegionAdapter : RegionAdapterBase<ScrollView>
/// <returns>A new instance of <see cref="Region"/>.</returns> /// <returns>A new instance of <see cref="Region"/>.</returns>
protected override IRegion CreateRegion(IContainerProvider container) => protected override IRegion CreateRegion(IContainerProvider container) =>
container.Resolve<Region>(); container.Resolve<Region>();
} }
\ No newline at end of file
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// Region that keeps all the views in it as active. Deactivation of views is not allowed. /// Region that keeps all the views in it as active. Deactivation of views is not allowed.
...@@ -11,7 +11,7 @@ public class AllActiveRegion : Region ...@@ -11,7 +11,7 @@ public class AllActiveRegion : Region
/// Creates a new <see cref="AllActiveRegion"/>. /// Creates a new <see cref="AllActiveRegion"/>.
/// </summary> /// </summary>
/// <param name="regionNavigationService"></param> /// <param name="regionNavigationService"></param>
public AllActiveRegion(IRegionNavigationService regionNavigationService) public AllActiveRegion(IRegionNavigationService regionNavigationService)
: base(regionNavigationService) : base(regionNavigationService)
{ {
} }
......
using System.ComponentModel; using System.ComponentModel;
using Prism.Ioc; using Prism.Ioc;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Populates the target region with the views registered to it in the <see cref="IRegionViewRegistry"/>. /// Populates the target region with the views registered to it in the <see cref="IRegionViewRegistry"/>.
...@@ -54,12 +54,12 @@ public class AutoPopulateRegionBehavior : RegionBehavior ...@@ -54,12 +54,12 @@ public class AutoPopulateRegionBehavior : RegionBehavior
Region.Add(targetName); Region.Add(targetName);
else if (defaultView is VisualElement element) else if (defaultView is VisualElement element)
Region.Add(element); Region.Add(element);
else if(defaultView is Type type) else if (defaultView is Type type)
{ {
var container = targetAware.Container; var container = targetAware.Container;
var registry = container.Resolve<IRegionNavigationRegistry>(); var registry = container.Resolve<IRegionNavigationRegistry>();
var registration = registry.Registrations.FirstOrDefault(x => x.View == type); var registration = registry.Registrations.FirstOrDefault(x => x.View == type);
if(registration is not null) if (registration is not null)
{ {
var view = registry.CreateView(container, registration.Name) as VisualElement; var view = registry.CreateView(container, registration.Name) as VisualElement;
Region.Add(view); Region.Add(view);
......
...@@ -3,10 +3,10 @@ using System.Collections.Specialized; ...@@ -3,10 +3,10 @@ using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
using Prism.Common; using Prism.Common;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Defines a behavior that forwards the <see cref="Xaml.RegionManager.RegionContextProperty"/> /// Defines a behavior that forwards the <see cref="Xaml.RegionManager.RegionContextProperty"/>
/// to the views in the region. /// to the views in the region.
/// </summary> /// </summary>
public class BindRegionContextToVisualElementBehavior : IRegionBehavior public class BindRegionContextToVisualElementBehavior : IRegionBehavior
......
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Behavior that removes the RegionManager attached property of all the views in a region once the RegionManager property of a region becomes null. /// Behavior that removes the RegionManager attached property of all the views in a region once the RegionManager property of a region becomes null.
...@@ -31,7 +31,7 @@ public class ClearChildViewsRegionBehavior : RegionBehavior ...@@ -31,7 +31,7 @@ public class ClearChildViewsRegionBehavior : RegionBehavior
if (target == null) if (target == null)
throw new ArgumentNullException(nameof(target)); throw new ArgumentNullException(nameof(target));
return (bool)target.GetValue(ClearChildViewsRegionBehavior.ClearChildViewsProperty); return (bool)target.GetValue(ClearChildViewsProperty);
} }
/// <summary> /// <summary>
...@@ -44,7 +44,7 @@ public class ClearChildViewsRegionBehavior : RegionBehavior ...@@ -44,7 +44,7 @@ public class ClearChildViewsRegionBehavior : RegionBehavior
if (target == null) if (target == null)
throw new ArgumentNullException(nameof(target)); throw new ArgumentNullException(nameof(target));
target.SetValue(ClearChildViewsRegionBehavior.ClearChildViewsProperty, value); target.SetValue(ClearChildViewsProperty, value);
} }
/// <summary> /// <summary>
...@@ -52,7 +52,7 @@ public class ClearChildViewsRegionBehavior : RegionBehavior ...@@ -52,7 +52,7 @@ public class ClearChildViewsRegionBehavior : RegionBehavior
/// </summary> /// </summary>
protected override void OnAttach() protected override void OnAttach()
{ {
this.Region.PropertyChanged += Region_PropertyChanged; Region.PropertyChanged += Region_PropertyChanged;
} }
private static void ClearChildViews(IRegion region) private static void ClearChildViews(IRegion region)
...@@ -70,9 +70,9 @@ public class ClearChildViewsRegionBehavior : RegionBehavior ...@@ -70,9 +70,9 @@ public class ClearChildViewsRegionBehavior : RegionBehavior
{ {
if (e.PropertyName == "RegionManager") if (e.PropertyName == "RegionManager")
{ {
if (this.Region.RegionManager == null) if (Region.RegionManager == null)
{ {
ClearChildViews(this.Region); ClearChildViews(Region);
} }
} }
} }
......
...@@ -2,13 +2,11 @@ ...@@ -2,13 +2,11 @@
using System.Globalization; using System.Globalization;
using Prism.Behaviors; using Prism.Behaviors;
using Prism.Extensions; using Prism.Extensions;
using Prism.Ioc; using Prism.Navigation.Regions.Adapters;
using Prism.Navigation.Xaml; using Prism.Navigation.Xaml;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Adapters;
using XamlNavigation = Prism.Navigation.Xaml.Navigation;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Behavior that creates a new <see cref="IRegion"/>, when the control that will host the <see cref="IRegion"/> (see <see cref="TargetElement"/>) /// Behavior that creates a new <see cref="IRegion"/>, when the control that will host the <see cref="IRegion"/> (see <see cref="TargetElement"/>)
...@@ -85,7 +83,7 @@ public class DelayedRegionCreationBehavior ...@@ -85,7 +83,7 @@ public class DelayedRegionCreationBehavior
/// Called when the <see cref="IRegionManager"/> is updating it's <see cref="IRegionManager.Regions"/> collection. /// Called when the <see cref="IRegionManager"/> is updating it's <see cref="IRegionManager.Regions"/> collection.
/// </summary> /// </summary>
/// <param name="sender">The <see cref="IRegionManager"/>. </param> /// <param name="sender">The <see cref="IRegionManager"/>. </param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
public void OnUpdatingRegions(object sender, EventArgs e) public void OnUpdatingRegions(object sender, EventArgs e)
{ {
TryCreateRegion(); TryCreateRegion();
......
using System.Collections.Specialized; using System.Collections.Specialized;
using Prism.Common; using Prism.Common;
using Prism.Navigation;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Provides a Behavior to Destroy the View/ViewModel when the View is removed from the Region's Views /// Provides a Behavior to Destroy the View/ViewModel when the View is removed from the Region's Views
......
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Defines a <see cref="IRegionBehavior"/> that not allows extensible behaviors on regions which also interact /// Defines a <see cref="IRegionBehavior"/> that not allows extensible behaviors on regions which also interact
......
using System.Collections.Specialized; using System.Collections.Specialized;
using Prism.Common; using Prism.Common;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Behavior that monitors a <see cref="IRegion"/> object and /// Behavior that monitors a <see cref="IRegion"/> object and
/// changes the value for the <see cref="IActiveAware.IsActive"/> property when /// changes the value for the <see cref="IActiveAware.IsActive"/> property when
/// an object that implements <see cref="IActiveAware"/> gets added or removed /// an object that implements <see cref="IActiveAware"/> gets added or removed
/// from the collection. /// from the collection.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This class can also sync the active state for any scoped regions directly on the view based on the <see cref="SyncActiveStateAttribute"/>. /// This class can also sync the active state for any scoped regions directly on the view based on the <see cref="SyncActiveStateAttribute"/>.
/// If you use the <see cref="Prism.Regions.Region.Add(VisualElement,string,bool)" /> method with the createRegionManagerScope option, the scoped manager will be attached to the view. /// If you use the <see cref="Regions.Region.Add(VisualElement,string,bool)" /> method with the createRegionManagerScope option, the scoped manager will be attached to the view.
/// </remarks> /// </remarks>
public class RegionActiveAwareBehavior : IRegionBehavior public class RegionActiveAwareBehavior : IRegionBehavior
{ {
...@@ -30,7 +30,7 @@ public class RegionActiveAwareBehavior : IRegionBehavior ...@@ -30,7 +30,7 @@ public class RegionActiveAwareBehavior : IRegionBehavior
/// </summary> /// </summary>
public void Attach() public void Attach()
{ {
INotifyCollectionChanged collection = this.GetCollection(); INotifyCollectionChanged collection = GetCollection();
if (collection != null) if (collection != null)
{ {
collection.CollectionChanged += OnCollectionChanged; collection.CollectionChanged += OnCollectionChanged;
...@@ -42,7 +42,7 @@ public class RegionActiveAwareBehavior : IRegionBehavior ...@@ -42,7 +42,7 @@ public class RegionActiveAwareBehavior : IRegionBehavior
/// </summary> /// </summary>
public void Detach() public void Detach()
{ {
INotifyCollectionChanged collection = this.GetCollection(); INotifyCollectionChanged collection = GetCollection();
if (collection != null) if (collection != null)
{ {
collection.CollectionChanged -= OnCollectionChanged; collection.CollectionChanged -= OnCollectionChanged;
...@@ -79,13 +79,13 @@ public class RegionActiveAwareBehavior : IRegionBehavior ...@@ -79,13 +79,13 @@ public class RegionActiveAwareBehavior : IRegionBehavior
{ {
if (item is VisualElement visualElement) if (item is VisualElement visualElement)
{ {
// We are assuming that any scoped region managers are attached directly to the // We are assuming that any scoped region managers are attached directly to the
// view. // view.
var regionManager = Xaml.RegionManager.GetRegionManager(visualElement); var regionManager = Xaml.RegionManager.GetRegionManager(visualElement);
// If the view's RegionManager attached property is different from the region's RegionManager, // If the view's RegionManager attached property is different from the region's RegionManager,
// then the view's region manager is a scoped region manager. // then the view's region manager is a scoped region manager.
if (regionManager == null || regionManager == this.Region.RegionManager) return; if (regionManager == null || regionManager == Region.RegionManager) return;
var activeViews = regionManager.Regions.SelectMany(e => e.ActiveViews); var activeViews = regionManager.Regions.SelectMany(e => e.ActiveViews);
...@@ -112,6 +112,6 @@ public class RegionActiveAwareBehavior : IRegionBehavior ...@@ -112,6 +112,6 @@ public class RegionActiveAwareBehavior : IRegionBehavior
private INotifyCollectionChanged GetCollection() private INotifyCollectionChanged GetCollection()
{ {
return this.Region.ActiveViews; return Region.ActiveViews;
} }
} }
using System.Runtime.Serialization; using System.Runtime.Serialization;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Represents errors that occured during region creation. /// Represents errors that occurred during region creation.
/// </summary> /// </summary>
[Serializable] [Serializable]
public partial class RegionCreationException : Exception public partial class RegionCreationException : Exception
...@@ -45,4 +45,4 @@ public partial class RegionCreationException : Exception ...@@ -45,4 +45,4 @@ public partial class RegionCreationException : Exception
: base(info, context) : base(info, context)
{ {
} }
} }
\ No newline at end of file
using System.ComponentModel; using System.ComponentModel;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Subscribes to a static event from the <see cref="RegionManager"/> in order to register the target <see cref="IRegion"/> /// Subscribes to a static event from the <see cref="RegionManager"/> in order to register the target <see cref="IRegion"/>
...@@ -107,7 +107,7 @@ public class RegionManagerRegistrationBehavior : RegionBehavior, IHostAwareRegio ...@@ -107,7 +107,7 @@ public class RegionManagerRegistrationBehavior : RegionBehavior, IHostAwareRegio
} }
/// <summary> /// <summary>
/// This event handler gets called when a RegionManager is requering the instances of a region to be registered if they are not already. /// This event handler gets called when a RegionManager is requiring the instances of a region to be registered if they are not already.
/// <remarks>Although this is a public method to support Weak Delegates in Silverlight, it should not be called by the user.</remarks> /// <remarks>Although this is a public method to support Weak Delegates in Silverlight, it should not be called by the user.</remarks>
/// </summary> /// </summary>
/// <param name="sender">The sender.</param> /// <param name="sender">The sender.</param>
...@@ -121,10 +121,10 @@ public class RegionManagerRegistrationBehavior : RegionBehavior, IHostAwareRegio ...@@ -121,10 +121,10 @@ public class RegionManagerRegistrationBehavior : RegionBehavior, IHostAwareRegio
{ {
if (element is VisualElement visualElement) if (element is VisualElement visualElement)
{ {
var regionmanager = RegionManagerAccessor.GetRegionManager(visualElement); var regionManager = RegionManagerAccessor.GetRegionManager(visualElement);
if (regionmanager != null) if (regionManager != null)
{ {
return regionmanager; return regionManager;
} }
} }
......
using System.Collections.Specialized; using System.Collections.Specialized;
using Prism.Common; using Prism.Common;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// The RegionMemberLifetimeBehavior determines if items should be removed from the <see cref="IRegion"/> /// The RegionMemberLifetimeBehavior determines if items should be removed from the <see cref="IRegion"/>
...@@ -9,10 +9,10 @@ namespace Prism.Regions.Behaviors; ...@@ -9,10 +9,10 @@ namespace Prism.Regions.Behaviors;
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// The <see cref="RegionMemberLifetimeBehavior"/> monitors the <see cref="IRegion.ActiveViews"/> /// The <see cref="RegionMemberLifetimeBehavior"/> monitors the <see cref="IRegion.ActiveViews"/>
/// collection to discover items that transition into a deactivated state. /// collection to discover items that transition into a deactivated state.
/// <p/> /// <p/>
/// The behavior checks the removed items for either the <see cref="IRegionMemberLifetime"/> /// The behavior checks the removed items for either the <see cref="IRegionMemberLifetime"/>
/// or the <see cref="RegionMemberLifetimeAttribute"/> (in that order) to determine if it should be kept /// or the <see cref="RegionMemberLifetimeAttribute"/> (in that order) to determine if it should be kept
/// alive on removal. /// alive on removal.
/// <p/> /// <p/>
/// If the item in the collection is a <see cref="VisualElement"/>, it will /// If the item in the collection is a <see cref="VisualElement"/>, it will
......
using Prism.Common; using Prism.Common;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions.Behaviors; namespace Prism.Navigation.Regions.Behaviors;
/// <summary> /// <summary>
/// Behavior that synchronizes the <see cref="IRegion.Context"/> property of a <see cref="IRegion"/> with /// Behavior that synchronizes the <see cref="IRegion.Context"/> property of a <see cref="IRegion"/> with
/// the control that hosts the Region. It does this by setting the <see cref="Xaml.RegionManager.RegionContextProperty"/> /// the control that hosts the Region. It does this by setting the <see cref="Xaml.RegionManager.RegionContextProperty"/>
/// Dependency Property on the host control. /// Dependency Property on the host control.
/// ///
/// This behavior allows the usage of two way databinding of the RegionContext from XAML. /// This behavior allows the usage of two way databinding of the RegionContext from XAML.
/// </summary> /// </summary>
public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegionBehavior public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegionBehavior
{ {
...@@ -16,7 +16,7 @@ public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegio ...@@ -16,7 +16,7 @@ public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegio
private VisualElement _hostControl; private VisualElement _hostControl;
/// <summary> /// <summary>
/// Name that identifies the SyncRegionContextWithHostBehavior behavior in a collection of RegionsBehaviors. /// Name that identifies the SyncRegionContextWithHostBehavior behavior in a collection of RegionsBehaviors.
/// </summary> /// </summary>
public static readonly string BehaviorKey = "SyncRegionContextWithHost"; public static readonly string BehaviorKey = "SyncRegionContextWithHost";
...@@ -52,7 +52,7 @@ public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegio ...@@ -52,7 +52,7 @@ public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegio
{ {
if (HostControl != null) if (HostControl != null)
{ {
// Sync values initially. // Sync values initially.
SynchronizeRegionContext(); SynchronizeRegionContext();
// Now register for events to keep them in sync // Now register for events to keep them in sync
......
using Prism.Ioc; using Prism.Ioc;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
internal class DefaultRegionManagerAccessor : IRegionManagerAccessor internal class DefaultRegionManagerAccessor : IRegionManagerAccessor
{ {
......
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// Provides an abstraction on top of the RegionManager static members. /// Provides an abstraction on top of the RegionManager static members.
...@@ -16,7 +16,7 @@ public interface IRegionManagerAccessor ...@@ -16,7 +16,7 @@ public interface IRegionManagerAccessor
/// Gets the value for the RegionName attached property. /// Gets the value for the RegionName attached property.
/// </summary> /// </summary>
/// <param name="element">The object to adapt. This is typically a container (i.e a control).</param> /// <param name="element">The object to adapt. This is typically a container (i.e a control).</param>
/// <returns>The name of the region that should be created when /// <returns>The name of the region that should be created when
/// the RegionManager is also set in this element.</returns> /// the RegionManager is also set in this element.</returns>
string GetRegionName(VisualElement element); string GetRegionName(VisualElement element);
......
using Prism.Regions.Behaviors; using Prism.Navigation.Regions.Behaviors;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// When implemented, allows an instance placed in a <see cref="IRegion"/> /// When implemented, allows an instance placed in a <see cref="IRegion"/>
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
using Prism.Ioc; using Prism.Ioc;
using Prism.Navigation.Xaml; using Prism.Navigation.Xaml;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
public interface ITargetAwareRegion : IRegion public interface ITargetAwareRegion : IRegion
{ {
VisualElement TargetElement { get; set; } VisualElement TargetElement { get; set; }
IContainerProvider Container => TargetElement.GetContainerProvider(); IContainerProvider Container => TargetElement.GetContainerProvider();
} }
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// Defines a class that wraps an item and adds metadata for it. /// Defines a class that wraps an item and adds metadata for it.
......
...@@ -4,7 +4,7 @@ using Prism.Ioc; ...@@ -4,7 +4,7 @@ using Prism.Ioc;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions.Navigation; namespace Prism.Navigation.Regions.Navigation;
/// <summary> /// <summary>
/// Implementation of <see cref="IRegionNavigationContentLoader"/> that relies on a <see cref="IContainerProvider"/> /// Implementation of <see cref="IRegionNavigationContentLoader"/> that relies on a <see cref="IContainerProvider"/>
...@@ -120,7 +120,7 @@ public class RegionNavigationContentLoader : IRegionNavigationContentLoader ...@@ -120,7 +120,7 @@ public class RegionNavigationContentLoader : IRegionNavigationContentLoader
{ {
var registry = region.Container().Resolve<IRegionNavigationRegistry>(); var registry = region.Container().Resolve<IRegionNavigationRegistry>();
var registration = registry.Registrations.FirstOrDefault(x => x.Type == ViewType.Region && (x.Name == candidateNavigationContract || x.View.Name == candidateNavigationContract || x.View.FullName == candidateNavigationContract)); var registration = registry.Registrations.FirstOrDefault(x => x.Type == ViewType.Region && (x.Name == candidateNavigationContract || x.View.Name == candidateNavigationContract || x.View.FullName == candidateNavigationContract));
if(registration is null) if (registration is null)
{ {
GetCandidatesFromRegionViews(region, registration.View.FullName); GetCandidatesFromRegionViews(region, registration.View.FullName);
} }
......
using Prism.Common; using Prism.Common;
using Prism.Ioc; using Prism.Ioc;
using Prism.Navigation;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions.Navigation; namespace Prism.Navigation.Regions.Navigation;
/// <summary> /// <summary>
/// Provides navigation for regions. /// Provides navigation for regions.
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
using System.Globalization; using System.Globalization;
using Prism.Ioc; using Prism.Ioc;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Navigation;
using Prism.Navigation.Xaml; using Prism.Navigation.Xaml;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// Implementation of <see cref="IRegion"/> that allows multiple active views. /// Implementation of <see cref="IRegion"/> that allows multiple active views.
......
...@@ -3,7 +3,7 @@ using System.Collections.Specialized; ...@@ -3,7 +3,7 @@ using System.Collections.Specialized;
using System.Globalization; using System.Globalization;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
internal class RegionCollection : IRegionCollection internal class RegionCollection : IRegionCollection
{ {
...@@ -63,7 +63,7 @@ internal class RegionCollection : IRegionCollection ...@@ -63,7 +63,7 @@ internal class RegionCollection : IRegionCollection
} }
_regions.Add(region); _regions.Add(region);
region.RegionManager = this.regionManager; region.RegionManager = regionManager;
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, region, 0)); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, region, 0));
} }
......
using Prism.Common; using Prism.Common;
using Prism.Regions.Behaviors; using Prism.Navigation.Regions.Behaviors;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// Class that holds methods to Set and Get the RegionContext from a BindableObject. /// Class that holds methods to Set and Get the RegionContext from a BindableObject.
......
using Prism.Ioc; using Prism.Ioc;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
internal static class RegionExtensions internal static class RegionExtensions
{ {
......
using Prism.Ioc; using Prism.Ioc;
using Prism.Navigation;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// This class is responsible for maintaining a collection of regions and attaching regions to controls. /// This class is responsible for maintaining a collection of regions and attaching regions to controls.
......
using Prism.Ioc; using Prism.Ioc;
using Prism.Mvvm; using Prism.Mvvm;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
internal class RegionNavigationRegistry : ViewRegistryBase, IRegionNavigationRegistry internal class RegionNavigationRegistry : ViewRegistryBase, IRegionNavigationRegistry
{ {
......
...@@ -6,15 +6,15 @@ using Prism.Ioc; ...@@ -6,15 +6,15 @@ using Prism.Ioc;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Properties; using Prism.Properties;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// Defines a registry for the content of the regions used on View Discovery composition. /// Defines a registry for the content of the regions used on View Discovery composition.
/// </summary> /// </summary>
public class RegionViewRegistry : IRegionViewRegistry public class RegionViewRegistry : IRegionViewRegistry
{ {
private readonly ListDictionary<string, Func<IContainerProvider, object>> _registeredContent = new (); private readonly ListDictionary<string, Func<IContainerProvider, object>> _registeredContent = new();
private readonly WeakDelegatesManager _contentRegisteredListeners = new (); private readonly WeakDelegatesManager _contentRegisteredListeners = new();
/// <summary> /// <summary>
/// Occurs whenever a new view is registered. /// Occurs whenever a new view is registered.
...@@ -75,7 +75,7 @@ public class RegionViewRegistry : IRegionViewRegistry ...@@ -75,7 +75,7 @@ public class RegionViewRegistry : IRegionViewRegistry
} }
/// <summary> /// <summary>
/// Registers a delegate that can be used to retrieve the content associated with a region name. /// Registers a delegate that can be used to retrieve the content associated with a region name.
/// </summary> /// </summary>
/// <param name="regionName">Region name to which the <paramref name="getContentDelegate"/> will be registered.</param> /// <param name="regionName">Region name to which the <paramref name="getContentDelegate"/> will be registered.</param>
/// <param name="getContentDelegate">Delegate used to retrieve the content associated with the <paramref name="regionName"/>.</param> /// <param name="getContentDelegate">Delegate used to retrieve the content associated with the <paramref name="regionName"/>.</param>
......
using Prism.Regions.Navigation; namespace Prism.Navigation.Regions;
namespace Prism.Regions;
/// <summary> /// <summary>
/// Region that allows a maximum of one active view at a time. /// Region that allows a maximum of one active view at a time.
......
...@@ -3,7 +3,7 @@ using System.Collections.ObjectModel; ...@@ -3,7 +3,7 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using Prism.Mvvm; using Prism.Mvvm;
namespace Prism.Regions; namespace Prism.Navigation.Regions;
/// <summary> /// <summary>
/// Implementation of <see cref="IViewsCollection"/> that takes an <see cref="ObservableCollection{T}"/> of <see cref="ItemMetadata"/> /// Implementation of <see cref="IViewsCollection"/> that takes an <see cref="ObservableCollection{T}"/> of <see cref="ItemMetadata"/>
...@@ -79,7 +79,7 @@ public class ViewsCollection : BindableBase, IViewsCollection ...@@ -79,7 +79,7 @@ public class ViewsCollection : BindableBase, IViewsCollection
///</returns> ///</returns>
IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator()
{ {
return this.GetEnumerator(); return GetEnumerator();
} }
/// <summary> /// <summary>
...@@ -121,12 +121,12 @@ public class ViewsCollection : BindableBase, IViewsCollection ...@@ -121,12 +121,12 @@ public class ViewsCollection : BindableBase, IViewsCollection
/// </summary> /// </summary>
private void RemoveAllMetadataMonitors() private void RemoveAllMetadataMonitors()
{ {
foreach (var item in this._monitoredItems) foreach (var item in _monitoredItems)
{ {
item.Key.MetadataChanged -= this.OnItemMetadataChanged; item.Key.MetadataChanged -= OnItemMetadataChanged;
} }
this._monitoredItems.Clear(); _monitoredItems.Clear();
} }
/// <summary> /// <summary>
...@@ -170,7 +170,7 @@ public class ViewsCollection : BindableBase, IViewsCollection ...@@ -170,7 +170,7 @@ public class ViewsCollection : BindableBase, IViewsCollection
bool foundInfo = _monitoredItems.TryGetValue(itemMetadata, out MonitorInfo monitorInfo); bool foundInfo = _monitoredItems.TryGetValue(itemMetadata, out MonitorInfo monitorInfo);
if (!foundInfo) return; if (!foundInfo) return;
if (this.Filter(itemMetadata)) if (Filter(itemMetadata))
{ {
if (!monitorInfo.IsInList) if (!monitorInfo.IsInList)
{ {
...@@ -178,7 +178,7 @@ public class ViewsCollection : BindableBase, IViewsCollection ...@@ -178,7 +178,7 @@ public class ViewsCollection : BindableBase, IViewsCollection
// as in our list so we can consider this // as in our list so we can consider this
// an Add. // an Add.
monitorInfo.IsInList = true; monitorInfo.IsInList = true;
this.UpdateFilteredItemsList(); UpdateFilteredItemsList();
NotifyAdd(itemMetadata.Item); NotifyAdd(itemMetadata.Item);
} }
} }
...@@ -188,7 +188,7 @@ public class ViewsCollection : BindableBase, IViewsCollection ...@@ -188,7 +188,7 @@ public class ViewsCollection : BindableBase, IViewsCollection
// tracking list, but should not remove any monitoring in // tracking list, but should not remove any monitoring in
// case it fits our filter in the future. // case it fits our filter in the future.
monitorInfo.IsInList = false; monitorInfo.IsInList = false;
this.RemoveFromFilteredList(itemMetadata.Item); RemoveFromFilteredList(itemMetadata.Item);
} }
} }
...@@ -214,11 +214,11 @@ public class ViewsCollection : BindableBase, IViewsCollection ...@@ -214,11 +214,11 @@ public class ViewsCollection : BindableBase, IViewsCollection
} }
// If we're sorting we can't predict how // If we're sorting we can't predict how
// the collection has changed on an add so we // the collection has changed on an add so we
// resort to a reset notification. // resort to a reset notification.
if (SortComparison != null) if (SortComparison != null)
{ {
this.NotifyReset(); NotifyReset();
} }
break; break;
...@@ -226,19 +226,19 @@ public class ViewsCollection : BindableBase, IViewsCollection ...@@ -226,19 +226,19 @@ public class ViewsCollection : BindableBase, IViewsCollection
case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Remove:
foreach (ItemMetadata itemMetadata in e.OldItems) foreach (ItemMetadata itemMetadata in e.OldItems)
{ {
this.RemoveMetadataMonitor(itemMetadata); RemoveMetadataMonitor(itemMetadata);
if (this.Filter(itemMetadata)) if (Filter(itemMetadata))
{ {
this.RemoveFromFilteredList(itemMetadata.Item); RemoveFromFilteredList(itemMetadata.Item);
} }
} }
break; break;
default: default:
this.ResetAllMonitors(); ResetAllMonitors();
this.UpdateFilteredItemsList(); UpdateFilteredItemsList();
this.NotifyReset(); NotifyReset();
break; break;
} }
...@@ -279,12 +279,12 @@ public class ViewsCollection : BindableBase, IViewsCollection ...@@ -279,12 +279,12 @@ public class ViewsCollection : BindableBase, IViewsCollection
public override int Compare(VisualElement x, VisualElement y) public override int Compare(VisualElement x, VisualElement y)
{ {
if (this.comparer == null) if (comparer == null)
{ {
return 0; return 0;
} }
return this.comparer(x, y); return comparer(x, y);
} }
} }
......
using System.ComponentModel; using System.Globalization;
using System.Globalization;
using System.Reflection; using System.Reflection;
using Prism.Common; using Prism.Common;
using Prism.Events; using Prism.Events;
using Prism.Extensions;
using Prism.Ioc; using Prism.Ioc;
using Prism.Navigation.Regions.Adapters;
using Prism.Navigation.Regions.Behaviors;
using Prism.Properties; using Prism.Properties;
using Prism.Regions.Adapters;
using Prism.Regions.Behaviors;
namespace Prism.Regions.Xaml; namespace Prism.Navigation.Regions.Xaml;
/// <summary> /// <summary>
/// A class to provide Bindable Properties and helpers for Regions. /// A class to provide Bindable Properties and helpers for Regions.
...@@ -58,7 +56,7 @@ public static class RegionManager ...@@ -58,7 +56,7 @@ public static class RegionManager
public static readonly BindableProperty DefaultViewProperty = public static readonly BindableProperty DefaultViewProperty =
BindableProperty.CreateAttached("DefaultView", typeof(object), typeof(RegionManager), null); BindableProperty.CreateAttached("DefaultView", typeof(object), typeof(RegionManager), null);
public static void SetDefaultView(VisualElement regionTarget, object viewNameTypeOrInstance) => public static void SetDefaultView(VisualElement regionTarget, object viewNameTypeOrInstance) =>
regionTarget.SetValue(DefaultViewProperty, viewNameTypeOrInstance); regionTarget.SetValue(DefaultViewProperty, viewNameTypeOrInstance);
public static object GetDefaultView(VisualElement regionTarget) => public static object GetDefaultView(VisualElement regionTarget) =>
......
...@@ -9,9 +9,9 @@ using Prism.Ioc; ...@@ -9,9 +9,9 @@ using Prism.Ioc;
using Prism.Modularity; using Prism.Modularity;
using Prism.Mvvm; using Prism.Mvvm;
using Prism.Navigation; using Prism.Navigation;
using Prism.Navigation.Regions;
using Prism.Navigation.Regions.Adapters;
using Prism.Navigation.Xaml; using Prism.Navigation.Xaml;
using Prism.Regions;
using Prism.Regions.Adapters;
using Prism.Services; using Prism.Services;
using TabbedPage = Microsoft.Maui.Controls.TabbedPage; using TabbedPage = Microsoft.Maui.Controls.TabbedPage;
......
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Modularity")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Modularity")]
[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Mvvm")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Mvvm")]
[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Navigation.Xaml")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Navigation.Xaml")]
[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Regions.Xaml")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Navigation.Regions.Xaml")]
[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Dialogs.Xaml")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Dialogs.Xaml")]
[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Xaml")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Xaml")]
using System; using System;
using Prism.Regions; using Prism.Navigation.Regions;
namespace Prism.Navigation; namespace Prism.Navigation;
......
using System; using System;
using Prism.Regions; using Prism.Navigation.Regions;
namespace Prism.Navigation; namespace Prism.Navigation;
......
using System; using System;
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Provides a way for objects involved in navigation to determine if a navigation request should continue. /// Provides a way for objects involved in navigation to determine if a navigation request should continue.
......
namespace Prism.Regions namespace Prism.Navigation.Regions
{ {
/// <summary> /// <summary>
/// Provides a way for objects involved in navigation to opt-out of being added to the IRegionNavigationJournal backstack. /// Provides a way for objects involved in navigation to opt-out of being added to the IRegionNavigationJournal backstack.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册