This file provides guidance to WARP (warp.dev) when working with code in this repository.
Sharpnado.MaterialFrame is a .NET MAUI library that provides enhanced Frame controls with modern material design themes including Light, Dark, Acrylic, and AcrylicBlur effects. The library supports multiple platforms (Android, iOS, Windows, macOS) with platform-specific renderers.
# Build the MAUI MaterialFrame library
dotnet build Maui.MaterialFrame/Maui.MaterialFrame.sln
# Build in Release mode for packaging
dotnet build Maui.MaterialFrame/Maui.MaterialFrame.sln -c Release
# Create NuGet package (automatically created on Release build)
dotnet pack Maui.MaterialFrame/Maui.MaterialFrame.csproj -c Release# Build the sample app
dotnet build Samples/Sharpnado.Acrylic.Maui/Sharpnado.Acrylic.Maui.sln
# Run sample app on specific platform
dotnet build Samples/Sharpnado.Acrylic.Maui/Sharpnado.Acrylic.Maui.csproj -f net9.0-android
dotnet build Samples/Sharpnado.Acrylic.Maui/Sharpnado.Acrylic.Maui.csproj -f net9.0-ios# For Android
dotnet build -f net9.0-android
# For iOS
dotnet build -f net9.0-ios
# For Windows
dotnet build -f net9.0-windows10.0.19041.0
# For macOS Catalyst
dotnet build -f net9.0-maccatalystMaterialFrame - The main control class (MaterialFrame.cs) extends MAUI Frame with material design themes:
- Supports 4 themes: Light, Dark, Acrylic, AcrylicBlur
- Platform-agnostic bindable properties for theming
- Global theme switching capability
Platform Renderers - Platform-specific implementations handle native rendering:
- Android:
AndroidMaterialFrameRenderer- Uses LayerDrawable for effects, RealtimeBlurView for blur - iOS:
iOSMaterialFrameRenderer- Uses CALayer for effects, UIVisualEffectView for blur - Windows:
WinUIMaterialFrameRenderer- Uses AcrylicBrush for native acrylic effects - macOS:
MacCatalystMaterialFrameRenderer- macOS-specific adaptations
Blur Implementation:
- Android: Custom port of RealtimeBlurView with render-to-texture blur
- iOS: Native UIVisualEffectView with Light/ExtraLight/Dark styles
- Windows: Native AcrylicBrush system
- Multi-Platform Rendering: Uses MAUI handlers pattern with platform-specific renderers
- Theme System: Global and per-control theming with dynamic theme switching
- Blur Abstraction: Platform-specific blur implementations behind common interface
- Property Binding: Extensive use of BindableProperty for XAML data binding
Maui.MaterialFrame/ # Main library project
├── MaterialFrame.cs # Core control class
├── Platforms/ # Platform-specific renderers
│ ├── Android/ # Android renderer + blur implementation
│ ├── iOS/ # iOS renderer
│ ├── Windows/ # WinUI renderer
│ └── MacCatalyst/ # macOS renderer
└── MauiAppBuilderExtensions.cs # Library initialization
Samples/ # Sample application
└── Sharpnado.Acrylic.Maui/ # MAUI sample app demonstrating features
In consumer projects, initialize in MauiProgram.cs:
builder.UseSharpnadoMaterialFrame(loggerEnable: false, debugLogEnable: false)Use the custom XAML namespace:
xmlns:sho="http://sharpnado.com"Android:
- Acrylic glow effect requires API 23+ (LayerDrawable limitation)
- Blur is computationally expensive, use AndroidBlurRootElement to optimize
- Configure static renderer properties for performance tuning
iOS:
- Dynamic theme switching to AcrylicBlur doesn't work properly
- Use native UIVisualEffectView blur styles
Windows:
- Native AcrylicBrush support provides optimal performance
- HostBackdropBlur available on UWP only (not WinUI 3)
- Add properties to
MaterialFrame.cswith BindableProperty backing - Update each platform renderer's
OnElementPropertyChangedmethod - Implement platform-specific rendering logic in renderer classes
- Update sample app to demonstrate new functionality
Each renderer follows this pattern:
- Inherit from appropriate base renderer (FrameRenderer, etc.)
- Override
OnElementPropertyChangedto handle property updates - Implement platform-specific drawing/styling in renderer methods
- Handle resource cleanup in
Disposemethod
- Light: Standard material elevation shadows
- Dark: Google dark theme elevation colors (no shadows)
- Acrylic: White glow layer + shadows
- AcrylicBlur: Platform blur effects (no shadows)
- Android blur is expensive - limit concurrent blur frames
- Use blur root element optimization on Android
- Dispose renderers properly to prevent memory leaks
- Cache drawable/layer objects where possible
| Platform | Support | Notes |
|---|---|---|
| Android | ✅ | API 21+, Acrylic glow requires API 23+ |
| iOS | ✅ | iOS 14.2+ |
| Windows | ✅ | WinUI, Windows 10.0.17763.0+ |
| macOS | ❓ | Catalyst support, not fully tested |
- Android emulator blur stalls: Reduce concurrent blur frames
- iOS dynamic blur switching: Known limitation, avoid dynamic AcrylicBlur changes
- Memory leaks: Ensure proper renderer disposal and unsubscribe from events