diff --git a/src/Uno.Extensions.Navigation.UI/Controls/FrameView.xaml.cs b/src/Uno.Extensions.Navigation.UI/Controls/FrameView.xaml.cs index 6884a6e3f6..8ed10b6cec 100644 --- a/src/Uno.Extensions.Navigation.UI/Controls/FrameView.xaml.cs +++ b/src/Uno.Extensions.Navigation.UI/Controls/FrameView.xaml.cs @@ -12,6 +12,9 @@ public sealed partial class FrameView : UserControl public FrameView() { InitializeComponent(); + + // Prevent inheritance of DataContext from Parent to avoid propagation to Children + DataContext = null; } /// diff --git a/testing/TestHarness/TestHarness.UITest/Ext/Navigation/PageNavigation/Given_PageNavigation.cs b/testing/TestHarness/TestHarness.UITest/Ext/Navigation/PageNavigation/Given_PageNavigation.cs index 31e3db07f6..954e1795c8 100644 --- a/testing/TestHarness/TestHarness.UITest/Ext/Navigation/PageNavigation/Given_PageNavigation.cs +++ b/testing/TestHarness/TestHarness.UITest/Ext/Navigation/PageNavigation/Given_PageNavigation.cs @@ -168,6 +168,19 @@ public void When_PageNavigationRegisteredRoot() } + [Test] + public void When_PageNavigationDataContextDidntChange() + { + InitTestSection(TestSections.Navigation_PageNavigation); + + App.WaitThenTap("ShowOnePageButton"); + App.WaitThenTap("OnePageGetUrlFromBrowser"); + + // If DataContext is ever changed to anything other than the expected + // the text will be "DataContext is not correct" + App.WaitForText("OnePageTxtDataContext", "DataContext is ok"); + } + private void OnePageToFivePage() { App.WaitThenTap("OnePageToTwoPageButton"); diff --git a/testing/TestHarness/TestHarness/Ext/Navigation/PageNavigation/PageNavigationOnePage.xaml b/testing/TestHarness/TestHarness/Ext/Navigation/PageNavigation/PageNavigationOnePage.xaml index a1175220ad..9df27ffda3 100644 --- a/testing/TestHarness/TestHarness/Ext/Navigation/PageNavigation/PageNavigationOnePage.xaml +++ b/testing/TestHarness/TestHarness/Ext/Navigation/PageNavigation/PageNavigationOnePage.xaml @@ -36,6 +36,9 @@ Click="{x:Bind ViewModel.SettingsWriteTest}" Content="Settings Write Test" /> +