Skip to content

Commit 1ec083a

Browse files
committed
More changes to fix a test
1 parent 0487aef commit 1ec083a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Controls/src/Core/MultiPage.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,17 @@ public T CurrentPage
8585
OnPropertyChanging();
8686

8787
// TODO: MAUI refine this to fire earlier
88-
_current?.SendNavigatingFrom(new NavigatingFromEventArgs(value, NavigationType.Replace));
88+
89+
// Send NavigatingFrom to the previous page or to the new page if no previous page exists
90+
if (_current is not null)
91+
{
92+
_current.SendNavigatingFrom(new NavigatingFromEventArgs(value, NavigationType.Replace));
93+
}
94+
else
95+
{
96+
// For initial page, send NavigatingFrom to itself
97+
value?.SendNavigatingFrom(new NavigatingFromEventArgs(value, NavigationType.Replace));
98+
}
8999

90100
_current = value;
91101

0 commit comments

Comments
 (0)