Skip to content

Commit

Permalink
Reduced duplicated code between Prism.Avalonia and Prism.Wpf `Navigat…
Browse files Browse the repository at this point in the history
…ion.Region`
  • Loading branch information
DamianSuess committed Dec 14, 2024
1 parent 6452d99 commit 3e214f3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 92 deletions.
27 changes: 0 additions & 27 deletions src/Avalonia/Prism.Avalonia/Navigation/Regions/AllActiveRegion.cs

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions src/Avalonia/Prism.Avalonia/Prism.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Prism.Avalonia helps you more easily design and build rich, flexible, and easy t
<Compile Include="..\..\Wpf\Prism.Wpf\PrismInitializationExtensions.cs" Link="PrismInitializationExtensions.cs" />
<Compile Include="..\..\Wpf\Prism.Wpf\Ioc\*.cs" LinkBase="Ioc" />
<Compile Include="..\..\Wpf\Prism.Wpf\Mvvm\*.cs" LinkBase="Mvvm" />
<Compile Include="..\..\Wpf\Prism.Wpf\Navigation\Regions\AllActiveRegion.cs" LinkBase="Navigation\Regions" />
<Compile Include="..\..\Wpf\Prism.Wpf\Navigation\Regions\ContentControlRegionAdapter.cs" LinkBase="Navigation\Regions" />

<Using Include="Prism.Extensions" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ protected override void Adapt(IRegion region, ContentControl regionTarget)
throw new ArgumentNullException(nameof(regionTarget));

bool contentIsSet = regionTarget.Content != null;
#if AVALONIA
contentIsSet = contentIsSet || regionTarget[ContentControl.ContentProperty] != null;
#else
contentIsSet = contentIsSet || regionTarget.HasBinding(ContentControl.ContentProperty);
#endif

if (contentIsSet)
throw new InvalidOperationException(Resources.ContentControlHasContentException);
Expand Down
1 change: 0 additions & 1 deletion src/Wpf/Prism.Wpf/PrismInitializationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ internal static void RegisterRequiredTypes(this IContainerRegistry containerRegi
internal static void RegisterDefaultRegionBehaviors(this IRegionBehaviorFactory regionBehaviors)
{
#if AVALONIA
//// Avalonia to WPF Equivilant: BindRegionContextToAvaloniaObjectBehavior == BindRegionContextToDependencyObjectBehavior
regionBehaviors.AddIfMissing<BindRegionContextToAvaloniaObjectBehavior>(BindRegionContextToAvaloniaObjectBehavior.BehaviorKey);
#else
regionBehaviors.AddIfMissing<BindRegionContextToDependencyObjectBehavior>(BindRegionContextToDependencyObjectBehavior.BehaviorKey);
Expand Down

0 comments on commit 3e214f3

Please sign in to comment.