11using System . Collections . ObjectModel ;
22
3- namespace Maui . Controls . Sample . Issues
3+ namespace Maui . Controls . Sample . Issues ;
4+
5+ [ Issue ( IssueTracker . Github , 28098 , "Returning back from navigation to MainPage would result in a blank screen" , PlatformAffected . iOS ) ]
6+ public partial class Issue28098 : ContentPage
47{
5- [ Issue ( IssueTracker . Github , 28098 , "Returning back from navigation to MainPage would result in a blank screen" , PlatformAffected . iOS ) ]
6- public partial class Issue28098 : ContentPage
8+ public Issue28098 ( )
9+ {
10+ InitializeComponent ( ) ;
11+ }
12+
13+ protected override void OnAppearing ( )
714 {
8- public Issue28098 ( )
9- {
10- InitializeComponent ( ) ;
11- }
12-
13- protected override void OnAppearing ( )
14- {
15- base . OnAppearing ( ) ;
16- _viewModel . OnAppearing ( ) ;
17- }
18- private async void Button_Clicked ( object sender , EventArgs e )
19- {
20- await Navigation . PushModalAsync ( new ActionPage ( ) ) ;
21- }
15+ base . OnAppearing ( ) ;
16+ _viewModel . OnAppearing ( ) ;
2217 }
18+ private async void Button_Clicked ( object sender , EventArgs e )
19+ {
20+ await Navigation . PushModalAsync ( new ActionPage ( ) ) ;
21+ }
22+ }
2323
24- public class ActionPage : ContentPage
24+ public class ActionPage : ContentPage
25+ {
26+ public ActionPage ( )
2527 {
26- public ActionPage ( )
27- {
28- var button = new Button { Text = "GoBack" , AutomationId = "BackButton" } ;
29- button . Clicked += async ( s , e ) => await Navigation . PopModalAsync ( ) ;
30- Content = button ;
31- }
28+ var button = new Button { Text = "GoBack" , AutomationId = "BackButton" } ;
29+ button . Clicked += async ( s , e ) => await Navigation . PopModalAsync ( ) ;
30+ Content = button ;
3231 }
32+ }
33+
34+ public class MainPageViewModel
35+ {
36+ public Command LoadItemsCommand { get ; }
37+ public ObservableCollection < Item > Items { get ; }
3338
34- public class MainPageViewModel
39+ public void OnAppearing ( )
3540 {
36- public Command LoadItemsCommand { get ; }
37- public ObservableCollection < Item > Items { get ; }
38-
39- public void OnAppearing ( )
40- {
41- LoadItemsCommand . Execute ( null ) ;
42- }
43-
44- void ExecuteLoadItemsCommand ( )
45- {
46- Items . Clear ( ) ;
47- Items . Add ( new Item ( ) { Name = "Item1" } ) ;
48- Items . Add ( new Item ( ) { Name = "Item2" } ) ;
49- }
50- public MainPageViewModel ( )
51- {
52- Items = new ObservableCollection < Item > ( ) ;
53-
54- LoadItemsCommand = new Command ( ( ) => ExecuteLoadItemsCommand ( ) ) ;
55- }
41+ LoadItemsCommand . Execute ( null ) ;
5642 }
5743
58- public class Item
44+ void ExecuteLoadItemsCommand ( )
45+ {
46+ Items . Clear ( ) ;
47+ Items . Add ( new Item ( ) { Name = "Item1" } ) ;
48+ Items . Add ( new Item ( ) { Name = "Item2" } ) ;
49+ }
50+ public MainPageViewModel ( )
5951 {
60- public string Name { get ; set ; }
52+ Items = new ObservableCollection < Item > ( ) ;
53+
54+ LoadItemsCommand = new Command ( ( ) => ExecuteLoadItemsCommand ( ) ) ;
6155 }
6256}
57+
58+ public class Item
59+ {
60+ public string Name { get ; set ; }
61+ }
0 commit comments