maui-accessibility
Guide for making .NET MAUI apps accessible — screen reader support via SemanticProperties, heading levels, AutomationProperties…
Guidance for picking photos/videos, capturing from camera, multi-select (.NET 10), MediaPickerOptions, platform permissions, and FileResult handling in .NET MAUI. USE FOR: "pick photo", "capture photo", "take picture", "pick video", "camera capture", "MediaPicker", "photo
$ npx -y skills add davidortinau/maui-skills --skill maui-media-picker --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/maui-media-pickerContext preview
The summary Claude sees to decide when to auto-load this skill.
Guidance for picking photos/videos, capturing from camera, multi-select (.NET 10), MediaPickerOptions, platform permissions, and FileResult handling in .NET MAUI. USE FOR: "pick photo", "capture photo", "take picture", "pick video", "camera capture", "MediaPicker", "photo
name: maui-media-picker description: >- Guidance for picking photos/videos, capturing from camera, multi-select (.NET 10), MediaPickerOptions, platform permissions, and FileResult handling in .NET MAUI. USE FOR: "pick photo", "capture photo", "take picture", "pick video", "camera capture", "MediaPicker", "photo gallery", "image picker", "multi-select photos", "MediaPickerOptions". DO NOT USE FOR: general file picking (use maui-file-handling), image display or optimization (use maui-performance), or camera streaming (use maui-platform-invoke).
Single-select returns `null`, multi-select returns an empty list. Not checking causes `NullReferenceException`.
// ❌ Crashes when user cancels var photo = await MediaPicker.Default.PickPhotoAsync(); using var stream = await photo.OpenReadAsync(); // ✅ Always check for null / empty var photo = await MediaPicker.Default.PickPhotoAsync(); if (photo is null) return; using var stream = await photo.OpenReadAsync();
All `MediaPicker` methods **must** run on the UI thread or they throw.
// ❌ Will throw on some platforms await Task.Run(async () => await MediaPicker.Default.PickPhotoAsync()); // ✅ Call directly from a command or event handler on the UI thread var photo = await MediaPicker.Default.PickPhotoAsync();
Devices without cameras (emulators, some tablets) will throw if you call capture methods.
// ❌ Crashes on devices without a camera
var photo = await MediaPicker.Default.CapturePhotoAsync();
// ✅ Guard with capability check
if (MediaPicker.Default.IsCaptureSupported)
{
var photo = await MediaPicker.Default.CapturePhotoAsync();
}`OpenReadAsync()` returns a stream that must be disposed.
// ❌ Leaks the stream var stream = await photo.OpenReadAsync(); var bytes = ReadAllBytes(stream); // ✅ Dispose with using using var stream = await photo.OpenReadAsync();
`MediaPickerOptions.SelectionLimit` is advisory. Always validate the count yourself:
var options = new MediaPickerOptions { SelectionLimit = 5 };
var results = await MediaPicker.Default.PickPhotosAsync(options);
if (results.Count() > 5)
{
// Warn user or take only the first 5
results = results.Take(5);
}Missing any one of `NSCameraUsageDescription`, `NSMicrophoneUsageDescription`, `NSPhotoLibraryUsageDescription`, or `NSPhotoLibraryAddUsageDescription` causes a runtime crash when that feature is accessed.
Without the `IMAGE_CAPTURE` query in `AndroidManifest.xml`, `CapturePhotoAsync` may fail silently on Android 11+ due to package visibility restrictions.
| Scenario | Method | |---|---| | User picks one photo | `PickPhotoAsync()` | | User picks multiple (.NET 10+) | `PickPhotosAsync()` with `SelectionLimit` | | App needs camera capture | Check `IsCaptureSupported` → `CapturePhotoAsync()` | | Save picked file permanently | Copy stream to `FileSystem.AppDataDirectory` | | Need photo metadata | Set `PreserveMetaData = true` in `MediaPickerOptions` |
A collection of 41 skills for .NET MAUI development, UI/UX design reasoning, and Xamarin migration, designed for use with GitHub Copilot CLI and Claude Code.
Guide for making .NET MAUI apps accessible — screen reader support via SemanticProperties, heading levels, AutomationProperties…
.NET MAUI view animations, custom animations, easing functions, rotation, scale, translation, and fade effects. USE FOR: "animate…
.NET MAUI app icon configuration, splash screen setup, SVG to PNG conversion at build time, composed/adaptive icons, and…
.NET MAUI app lifecycle guidance covering the four app states (not running, running, deactivated, stopped), cross-platform Window…
Guide for .NET MAUI apps consuming .NET Aspire-hosted backend services. Covers AppHost configuration, service discovery for…
Add authentication to .NET MAUI apps. Covers WebAuthenticator for generic OAuth 2.0 / social login, and MSAL.NET for Microsoft…