A Clean Foundation for Scalable .NET MAUI Apps
Building a .NET MAUI application that stays clean, maintainable, and scalable over time is not trivial.
As soon as your app grows beyond a few pages, you start facing recurring problems:
- Where should lifecycle logic live?
- How do you reliably react to app foreground/background events?
- How do you pass parameters between pages without fragile string-based navigation?
- How do you keep dependency injection structured as the app grows?
That’s exactly why MobileConcept.Maui.Core exists.
👉 GitHub: https://github.com/maui-plaroche/MobileConcept.Maui.Core
Why MobileConcept.Maui.Core?
MobileConcept.Maui.Core is an essential core library for .NET MAUI applications targeting Android and iOS.
It provides a strong MVVM foundation, lifecycle handling, and a structured architecture that removes boilerplate and guesswork.
Instead of reinventing patterns for every project, this library gives you:
- A consistent ViewModel lifecycle
- Application lifecycle events at the ViewModel level
- Type-safe navigation with parameter passing
- A clean Bootstrapper pattern for dependency injection
- Practical helpers and extensions for common mobile scenarios
All without fighting against MAUI or Shell.
Installation
Add the package via the CLI:
dotnet add package MobileConcept.Maui.CoreCode language: CSS (css)
Or using NuGet:
Install-Package MobileConcept.Maui.CoreCode language: CSS (css)
Requirements
- .NET 10.0 or later
- .NET MAUI 10.0 or later
One-Line Setup That Changes Everything
The heart of the library is activated with a single line in MauiProgram.cs:
builder
.UseMauiApp<App>()
.UseMobileConcept(); // 👈 Required
Code language: HTML, XML (xml)
This does several important things automatically:
- Registers core services (like
INavigationService) - Hooks into Android and iOS app lifecycle events
- Forwards lifecycle events directly to your ViewModels
No platform-specific code. No handlers to wire manually.
A Clean Bootstrapper Pattern for DI
As your app grows, dumping everything into MauiProgram.cs quickly becomes unmanageable.
MobileConcept.Maui.Core introduces a simple but powerful BootstrapperBase:
public class SampleDemoBootstrapper : BootstrapperBase
{
public SampleDemoBootstrapper(IServiceCollection services) : base(services) {}
protected override void RegisterServices()
{
Services.AddSingleton<IMyService, MyService>();
}
protected override void RegisterViewModels()
{
Services.AddTransient<MainPageViewModel>();
Services.AddTransient<SecondPageViewModel>();
}
protected override void RegisterViews()
{
Services.AddTransient<MainPage>();
Services.AddTransient<SecondPage>();
}
}
Code language: HTML, XML (xml)
Your DI configuration becomes:
- Readable
- Predictable
- Easy to scale
And initialization stays explicit and controlled.
ViewModel Lifecycle — Done Right
Every ViewModel inherits from ViewModelBase, giving you lifecycle hooks that actually make sense in MVVM.
public class MainPageViewModel : ViewModelBase
{
public override Task OnAppearingAsync() { }
public override Task OnDisappearingAsync() { }
public override Task OnAppStartAsync() { }
public override Task OnAppEnterForegroundAsync() { }
public override Task OnAppEnterBackgroundAsync() { }
}
Why this matters
- No logic in code-behind
- No guessing when lifecycle events fire
- The same behavior on Android and iOS
You can load data, cancel subscriptions, or persist state exactly where it belongs: the ViewModel.
Type-Safe Navigation (No More String Routes)
Navigation is handled through INavigationService:
await navigationService.NavigateToAsync<SecondPage>(
"test",
1,
new List<object> { "test", 1 }
);
Code language: JavaScript (javascript)
On the receiving side:
public override Task InitializeAsync(params object[] args)
{
var message = args[0] as string;
var number = (int)args[1];
return Task.CompletedTask;
}
Code language: PHP (php)
Benefits
- No fragile route strings
- Compile-time safety
- Multiple parameters supported
- Clear intent in code
Pages That Respect MVVM
Pages inherit from BaseContentPage<TViewModel>:
<views:BaseContentPage
x:TypeArguments="viewModels:MainPageViewModel"
x:Class="MobileConceptSample.MainPage">
</views:BaseContentPage>
Code language: HTML, XML (xml)
And in code-behind:
public MainPage(MainPageViewModel viewModel) : base(viewModel)
{
InitializeComponent();
EnableLifecycleEvents = true;
}
Code language: PHP (php)
That’s it.
Lifecycle events are now forwarded automatically to your ViewModel.
Handling App Foreground & Background Transitions
Mobile apps live and die by lifecycle correctness.
With MobileConcept.Maui.Core, your ViewModels receive:
| Platform | Foreground | Background |
|---|---|---|
| Android | OnResume | OnPause |
| iOS | OnActivated | OnResignActivation |
No platform checks. No conditional compilation.
Image Helpers That Actually Solve Real Problems
Anyone who has dealt with camera images knows about EXIF rotation issues.
The ImageRotationHelper solves this:
var stream = await result.OpenReadAsync();
var processed = ImageRotationHelper.ResizeProportionalWithExifRotation(
stream,
maxWidth: 400,
maxHeight: 400
);
Code language: JavaScript (javascript)
What you get
- Correct orientation
- Proportional resizing
- Lower memory usage
- Identical behavior on Android & iOS
Recommended Project Structure
MyMauiApp/
├── Bootstrap/
├── ViewModels/
├── Views/
├── Services/
├── AppShell.xaml
├── App.xaml
└── MauiProgram.cs
This structure works naturally with the library and keeps responsibilities clear.
Best Practices
- ✅ Always call
.UseMobileConcept() - ✅ Enable lifecycle events on pages
- ✅ Load data in
OnAppearingAsync - ✅ Save state in
OnAppEnterBackgroundAsync - ✅ Keep navigation parameters simple
- ✅ Let ViewModels own behavior
Final Thoughts
MobileConcept.Maui.Core doesn’t try to replace MAUI.
It completes it.
It gives you the missing architectural pieces that real-world mobile apps need:
- Predictable lifecycle handling
- Clean navigation
- Scalable dependency injection
- Less boilerplate, more intent
If you’re serious about building maintainable .NET MAUI applications, this library will feel like home.
👉 GitHub: https://github.com/maui-plaroche/MobileConcept.Maui.Core
📦 NuGet: https://www.nuget.org/packages/MobileConcept.Core
📖 More content: https://www.mobile-concept.com



