diff --git a/MPowerKit.Regions/MPowerKit.Regions.csproj b/MPowerKit.Regions/MPowerKit.Regions.csproj
index 93153db..6b957c2 100644
--- a/MPowerKit.Regions/MPowerKit.Regions.csproj
+++ b/MPowerKit.Regions/MPowerKit.Regions.csproj
@@ -9,7 +9,7 @@
True
MPowerKit.Regions
- 1.3.0
+ 1.3.1
MPowerKit,Alex Dobrynin
.NET MAUI MVVM navigation framework. It supports regular/modal navigation, opening/closing windows, regions
MPowerKit
diff --git a/MPowerKit.Regions/RegionManager.cs b/MPowerKit.Regions/RegionManager.cs
index 2e56f2d..804cf0b 100644
--- a/MPowerKit.Regions/RegionManager.cs
+++ b/MPowerKit.Regions/RegionManager.cs
@@ -65,6 +65,19 @@ public virtual async ValueTask NavigateTo(string regionName, s
}
}
+ public virtual IRegion? GetRegionByName(string regionName)
+ {
+ if (!_regionHolders.TryGetValue(regionName, out WeakReference? value))
+ {
+ throw new ArgumentNullException($"There is not registered region with name {regionName}");
+ }
+
+ var regionHolder = (value.TryGetTarget(out var target) ? target : null)
+ ?? throw new NullReferenceException("Region was disposed");
+
+ return ViewServiceProviderAttached.GetServiceScope(regionHolder)?.ServiceProvider.GetRequiredService();
+ }
+
public virtual IEnumerable GetRegions(VisualElement? regionHolder)
{
var holders = RegionHolders.Where(v => MvvmHelpers.IsParentRegionHolder(v, regionHolder));