Advanced & Enterprise

8 questions found

Blazor Hybrid hosts Blazor (Razor) components in a BlazorWebView inside a native MAUI app, running .NET locally (not on a server) with full native API access. Use it to reuse web UI/components across web and native, or when your team prefers HTML/CSS. You can mix Blazor and native MAUI pages in one app.
<BlazorWebView HostPage="wwwroot/index.html">
    <BlazorWebView.RootComponents>
        <RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
    </BlazorWebView.RootComponents>
</BlazorWebView>
Real-world example A company reuses its Blazor component library to build the mobile app's UI while still calling native device APIs.

Common follow-ups: Does Blazor Hybrid need a server? | Can you mix native and Blazor pages?

Blazor Hybrid Advanced & Enterprise Platform Integration
The MAUI Community Toolkit is a package of behaviors, converters, animations, views (e.g., popups, MediaElement, DrawingView, Expander), and helpers that fill gaps in the core framework. It reduces boilerplate for common needs and is community-maintained but widely used in production.
// Show a popup from the toolkit
await this.ShowPopupAsync(new ConfirmPopup());
Real-world example A team adds MediaElement and a Popup from the toolkit instead of writing custom handlers for video and dialogs.

Common follow-ups: Is it the same as CommunityToolkit.Mvvm? | Name a few toolkit features.

MAUI Community Toolkit MVVM Toolkit Advanced & Enterprise
Use .resx resource files (AppResources.resx plus AppResources.<culture>.resx), access strings via the generated resource class, and set Thread.CurrentThread.CurrentUICulture. Bind UI text to a localization helper or use a markup extension. For RTL, set FlowDirection. Format dates/numbers with the current culture.
// Strings.fr.resx provides French; select at runtime
CultureInfo.CurrentUICulture = new CultureInfo("fr");
label.Text = AppResources.WelcomeMessage;
Real-world example An app ships English and French, switching all UI strings when the user changes language in settings.

Common follow-ups: How do you handle RTL layouts? | Where are localized strings stored?

Localization Accessibility & UX Advanced & Enterprise
Define colors and styles in ResourceDictionaries (App.xaml), use AppThemeBinding to switch values by system theme, and read/set Application.Current.UserAppTheme to override. Centralize styles with implicit and explicit Style resources so theming is consistent and switchable at runtime.
<Label TextColor="{AppThemeBinding Light=Black, Dark=White}" />
Application.Current.UserAppTheme = AppTheme.Dark;   // force dark
Real-world example The app follows the OS dark mode automatically but also lets users force a theme from settings via UserAppTheme.

Common follow-ups: What is AppThemeBinding? | How do you force a theme?

Styling Themes Advanced & Enterprise
Separate concerns into projects: the MAUI head (UI, pages, view models), a shared domain/core library (models, services, interfaces), infrastructure (data, API clients), and a test project. Use DI throughout, MVVM with compiled bindings, and feature folders. Keep platform code isolated behind interfaces so the core stays portable and testable.
MyApp.sln
├─ MyApp.Maui        (UI, ViewModels)
├─ MyApp.Core        (Models, Interfaces, Services)
├─ MyApp.Infrastructure (Api, Sqlite)
└─ MyApp.Tests       (xUnit)
Real-world example A large team keeps business logic in MyApp.Core so it's shared, unit-tested, and independent of the MAUI UI.

Common follow-ups: Why isolate platform code behind interfaces? | Where does business logic live?

Architecture Dependency Injection Testing & Debugging
Set SemanticProperties (Description, Hint, HeadingLevel) so screen readers (TalkBack/VoiceOver) announce controls meaningfully; ensure sufficient color contrast; support dynamic font sizes; provide focus order; and use SemanticScreenReader.Announce for dynamic messages. Test with the platform screen readers.
<Button Text="Save"
        SemanticProperties.Description="Save the current form"
        SemanticProperties.Hint="Double tap to save" />
SemanticScreenReader.Announce("Item saved");
Real-world example A banking app meets accessibility requirements by describing every control and announcing balance updates to screen-reader users.

Common follow-ups: What does SemanticProperties do? | How do you announce dynamic changes?

Accessibility & UX Localization Advanced & Enterprise
Handle Window lifecycle events—Created, Activated, Deactivated, Stopped, Resumed, Destroying—overridden on the Window or subscribed via App. Use Stopped/Deactivated to persist state and release resources, and Resumed to refresh data or reconnect. For platform specifics, use lifecycle events in ConfigureLifecycleEvents.
protected override Window CreateWindow(IActivationState? state)
{
    var window = base.CreateWindow(state);
    window.Stopped  += (s, e) => SaveState();
    window.Resumed  += (s, e) => RefreshData();
    return window;
}
Real-world example A form auto-saves a draft when the app is backgrounded and reloads it on resume so users never lose input.

Common follow-ups: Which event fires on backgrounding? | What is ConfigureLifecycleEvents?

App Lifecycle Platform Integration Advanced & Enterprise
Integrate Firebase Cloud Messaging (Android) and APNs (iOS), typically via a service like Azure Notification Hubs or a plugin that unifies them. Register for a device token, send it to your backend, handle incoming messages per platform, and route taps to the right page via Shell. Request notification permission on iOS 13+/Android 13+.
// After obtaining the platform token
await _api.RegisterDeviceAsync(deviceToken, userId);
// On notification tap
await Shell.Current.GoToAsync($"//orders/details?id={payload.OrderId}");
Real-world example Order-status pushes deep-link users straight to the relevant order when tapped, driven by FCM/APNs tokens registered with the backend.

Common follow-ups: How do FCM and APNs differ? | How do you route a notification tap?

Push Notifications Platform Integration Shell Navigation