diff --git a/samples/CommunityToolkit.Maui.Sample/AppShell.xaml.cs b/samples/CommunityToolkit.Maui.Sample/AppShell.xaml.cs index db32d4197..55a555c9b 100644 --- a/samples/CommunityToolkit.Maui.Sample/AppShell.xaml.cs +++ b/samples/CommunityToolkit.Maui.Sample/AppShell.xaml.cs @@ -110,6 +110,7 @@ public partial class AppShell : Shell CreateViewModelMapping(), CreateViewModelMapping(), CreateViewModelMapping(), + CreateViewModelMapping(), CreateViewModelMapping(), CreateViewModelMapping(), CreateViewModelMapping(), diff --git a/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs b/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs index f56ae1774..2bce37b94 100644 --- a/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs +++ b/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs @@ -168,6 +168,7 @@ static void RegisterViewsAndViewModels(in IServiceCollection services) // Add Views Pages + ViewModels services.AddTransientWithShellRoute(); services.AddTransientWithShellRoute(); + services.AddTransientWithShellRoute(); services.AddTransientWithShellRoute(); services.AddTransientWithShellRoute(); services.AddTransientWithShellRoute(); diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/CustomLazyView.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/CustomLazyView.cs new file mode 100644 index 000000000..9d463b926 --- /dev/null +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/CustomLazyView.cs @@ -0,0 +1,21 @@ +using CommunityToolkit.Maui.Markup; + +namespace CommunityToolkit.Maui.Sample.Pages.Views.LazyView; + +public class CustomLazyView : Maui.Views.LazyView where TView : View, new() +{ + public override async ValueTask LoadViewAsync() + { + // display a loading indicator + Content = new ActivityIndicator { IsRunning = true }.Center(); + + // simulate a long running task + await Task.Delay(3000); + + // load the view + Content = new TView { BindingContext = BindingContext }; + + SetHasLazyViewLoaded(true); + } +} + diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml new file mode 100644 index 000000000..1d1987bff --- /dev/null +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + +