1. Fundamentals (15)
What is .NET MAUI?
Cross-platform framework for building native mobile (Android/iOS) and desktop (macOS/Windows) apps with C#/XAML.MAUI vs Xamarin.Forms?
Single project, improved performance, better Hot Reload, new controls.Entry point?
MauiProgram.cs→CreateMauiApp().Supported OS versions?
Android 5.0+, iOS 10+, macOS 10.15+, Windows 10+.What is
MauiAppBuilder?
Configures services/fonts:var builder = MauiApp.CreateBuilder(); builder.UseMauiApp<App>();
What is
App.xaml?
Defines global resources and startup page.How to set startup page?
MainPage = new MainPage();
What is
HostBuilder?
Configures dependency injection and services.How to use
ConfigureEssentials?
Enables device features (GPS, storage):builder.ConfigureEssentials(essentials => {...});
What is Blazor Hybrid?
Embeds Blazor web components in MAUI apps.How to enable Hot Reload?
SetEnableHotReloadin project file.What is AOT compilation?
Ahead-of-Time compilation for better Android performance.How to check platform?
if (DeviceInfo.Platform == DevicePlatform.Android) {...}
What is
IDispatcher?
Ensures UI updates run on main thread.How to handle lifecycle events?
OverrideOnStart,OnSleep,OnResumeinApp.xaml.cs.
2. UI & XAML (25)
How to create a Button?
<Button Text="Click" Command="{Binding TapCommand}"/>What is
BindableProperty?
Enables data binding, styling, and defaults:public static readonly BindableProperty TextProperty = ...;
How to bind data?
<Label Text="{Binding UserName}"/>What is
x:Name?
Assigns a name to a XAML element for code-behind access.StaticResourcevsDynamicResource?StaticResourceis fixed;DynamicResourceupdates dynamically.How to create a custom control?
SubclassContentView+ defineBindableProperty.What is
ControlTemplate?
Defines reusable control templates.How to apply styles?
<Style TargetType="Label"> <Setter Property="TextColor" Value="Red"/> </Style>
What is
VisualStateManager?
Manages visual states (e.g., "Pressed", "Disabled").How to handle dark mode?
<Label TextColor="{AppThemeBinding Light=Black, Dark=White}"/>How to use
Grid?<Grid> <Label Grid.Row="0" Grid.Column="0" Text="Hello"/> </Grid>
What is
FlexLayout?
Responsive layout with flexbox-like behavior.How to use
CollectionView?<CollectionView ItemsSource="{Binding Items}"> <DataTemplate><Label Text="{Binding Name}"/></DataTemplate> </CollectionView>
What is
SwipeView?
Enables swipe gestures on items.How to use
CarouselView?
Displays items in a carousel.What is
RefreshView?
Adds pull-to-refresh functionality.How to create a
Picker?<Picker ItemsSource="{Binding Options}" SelectedItem="{Binding SelectedOption}"/>What is
Border?
Adds borders to any control.How to use
GraphicsView?
For custom 2D drawings.What is
LazyView?
Delays loading of heavy UI elements.How to handle orientation changes?
Subscribe toDeviceDisplay.MainDisplayInfoChanged.What is
InputTransparent?
Makes a control ignore touch events.How to animate controls?
UseViewExtensions(e.g.,FadeTo,TranslateTo).What is
SemanticProperties?
Improves accessibility (e.g., screen readers).How to use
WebView?<WebView Source="https://example.com"/>
3. Navigation (15)
How to navigate between pages?
await Navigation.PushAsync(new DetailsPage());
What is Shell?
Container for flyouts, tabs, and URI navigation.How to use URI navigation?
await Shell.Current.GoToAsync("details?id=123");
How to pass complex data?
Serialize to JSON:await Shell.Current.GoToAsync($"details?data={Uri.EscapeDataString(json)}");
What is
RegisterRoute?
Maps URIs to pages:Routing.RegisterRoute("details", typeof(DetailsPage));
How to handle back navigation?
await Navigation.PopAsync();
What is a
Flyout?
Hamburger-style menu in Shell.How to create a
TabBar?<TabBar> <Tab Title="Home"><ShellContent ContentTemplate="{DataTemplate HomePage}"/></Tab> </TabBar>
What is
Modalnavigation?
Pages that dismiss independently (e.g., popups).How to prevent duplicate pages?
Check navigation stack before pushing.What is
INavigationService?
Abstraction for decoupled navigation.How to deep link?
Register URIs inApp.xaml.cs:App.Current.AppLinks.RegisterLink(...);
How to customize navigation transitions?
OverrideOnNavigatinginShell.What is
NavigationPage?
Legacy stack-based navigation.How to handle navigation guards?
OverrideOnAppearing/OnDisappearing.
4. MVVM (20)
What is MVVM?
Model-View-ViewModel pattern for separation of concerns.How to implement
INotifyPropertyChanged?public class ViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; void OnPropertyChanged([CallerMemberName] string name = "") => PropertyChanged?.Invoke(this, new(name)); }
What is
ICommand?
Encapsulates UI actions:public ICommand SaveCommand => new Command(() => Save());
How to bind commands?
<Button Command="{Binding SaveCommand}"/>What is
ObservableCollection?
Notifies UI when items change.How to use
x:DataType?
Enables compiled bindings:<StackLayout x:DataType="local:ViewModel"> <Label Text="{Binding Name}"/> </StackLayout>
What is
ValueConverter?
Transforms data for binding:public class BoolToColorConverter : IValueConverter {...}
How to validate input?
Use data annotations:[Required(ErrorMessage = "Required")] public string Username { get; set; }
What is
MessagingCenter?
Pub/sub communication:MessagingCenter.Send(this, "Refresh");
How to use
CommunityToolkit.MVVM?
Simplifies MVVM with attributes:[ObservableProperty] string name;
What is
Behavior?
Reusable UI logic (e.g., validation).How to debug binding errors?
Check Output window for binding logs.What is
BindingMode?
Defines binding direction (OneWay, TwoWay).How to bind to a parent's context?
<Label Text="{Binding Source={RelativeSource AncestorType={x:Type Page}}, Path=BindingContext.Title}"/>What is
FallbackValue?
Default value if binding fails.How to use
MultiBinding?
Binds multiple properties to one control.What is
INotifyDataErrorInfo?
Advanced validation interface.How to bind to an indexer?
<Label Text="{Binding Items[0]}"/>What is
RelayCommand?
LightweightICommandimplementation.How to test ViewModels?
Use xUnit/Moq:[Fact] public void TestSave() { var vm = new ViewModel(); vm.SaveCommand.Execute(null); Assert.True(vm.IsSaved); }
5. Platform-Specific (15)
How to access camera?
var photo = await MediaPicker.CapturePhotoAsync();
What is
DependencyService?
Resolves platform-specific implementations.How to use
Platforms/folders?
Place platform-specific code inPlatforms/Android,Platforms/iOS.How to request permissions?
var status = await Permissions.RequestAsync<Permissions.Camera>();
What is
DeviceInfo?
Provides device details (OS, model).How to handle Android back button?
OverrideOnBackButtonPressed.What is
Custom Renderers?
Legacy way to customize native controls.How to use
Handlers?
MAUI's replacement for renderers:Microsoft.Maui.Handlers.ButtonHandler.Mapper.AppendToMapping(...);
How to access native APIs?
UseDependencyServiceor partial classes:#if ANDROID // Android-specific code #endif
What is
Essentials?
Cross-platform APIs (geolocation, sensors).How to play sounds?
UseMediaElementor platform APIs.How to handle iOS Safe Area?
<ContentPage xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls" ios:Page.UseSafeArea="True">How to create a splash screen?
Add platform-specific splash screen assets.What is
MacCatalyst?
macOS implementation of MAUI.How to debug platform code?
Use#if DEBUG+ platform debuggers.
6. Performance (10)
How to optimize startup?
Enable AOT, lazy-load resources.What is
Compiled Bindings?
Pre-compiles bindings for speed.How to reduce APK size?
Enable linking (<PublishTrimmed>true</PublishTrimmed>).What is
Fast Renderers?
Flattens view hierarchy for native controls.How to profile?
Use Visual Studio Diagnostics Tools.What is
WeakReferenceManager?
Prevents memory leaks in events.How to optimize
CollectionView?
UseDataTemplateSelector+ virtualization.What is
OnAppearing?
Lifecycle method for page load.How to cache images?
UseFFImageLoadingorImageSourceConverter.How to disable XAML compilation?
<ContentPage x:Class="..." x:Compile="False">
Key Takeaways:
Shell for advanced navigation
MVVM for clean architecture
Handlers replace custom renderers
AOT for Android performance
Platforms/ for OS-specific code
No comments:
Post a Comment