Skip to content

Update all Basic samples to multi-page layouts with designer support#3553

Open
mattleibow wants to merge 214 commits intomainfrom
samples
Open

Update all Basic samples to multi-page layouts with designer support#3553
mattleibow wants to merge 214 commits intomainfrom
samples

Conversation

@mattleibow
Copy link
Contributor

Summary

Update all 14 Basic samples to demonstrate multiple rendering modes with proper designer/layout file support.

Pages per sample:

  • CPU Canvas: Radial gradient background + colored circles + centered "SkiaSharp" text
  • GPU (1 page per backend): SkSL metaball shader with touch/mouse interaction + FPS overlay
  • Drawing: Multi-stroke canvas with color picker + brush sizing (where input is supported)

Navigation:

Each platform uses its idiomatic navigation pattern (sidebar, drawer, tabs, flyout).

Designer support:

Every sample uses the platform's native layout/designer system:

  • Android: XML layout files (Resources/layout/)
  • iOS/macOS/tvOS/MacCatalyst: Storyboards with SkiaSharp views as custom classes
  • WPF/WinUI/MAUI/UnoPlatform: XAML with SkiaSharp views declared in markup
  • WindowsForms: .Designer.cs files with SKControl/SKGLControl
  • Gtk3: .glade file for GTK Builder
  • Gtk4: .ui file for GTK4 Builder
  • Blazor: .razor component markup
  • Tizen: ElmSharp (no visual designer available)

Platform matrix:

Sample Pages GPU Backends Drawing Designer
Android 4 SurfaceView, TextureView XML layouts
iOS 4 GL, Metal Storyboard
macOS 4 GL, Metal Storyboard
tvOS 3 GL, Metal ❌ (Siri Remote) Storyboard
MacCatalyst 3 Metal Storyboard
MAUI 3 SKGLView XAML
WPF 3 OpenGL XAML
WinUI 3 ANGLE/DirectX XAML
WinForms 3 OpenGL .Designer.cs
UnoPlatform 3 ANGLE/DirectX XAML
Blazor 3 WebGL .razor
Tizen 3 GL ES Code
Gtk3 2 .glade
Gtk4 2 .ui

Ref: Cherry-picked from PR #3541 for Blazor sample.

- Pin SDK to 10.0.103 with workload sets in global.json
- Restructure TFMs: TFMBase=net6.0, TFMPrevious=net9.0, TFMCurrent=net10.0
- Remove TFMNext and all associated conditional blocks
- Remove MAUI TPV workaround (dotnet/maui#24263 fixed in .NET 9+)
- Update all 14 NativeAssets csproj files to TFMPrevious+TFMCurrent pattern
- Update platform TPVs for .NET 9 (Previous) and .NET 10 (Current)
- Replace workload install script with dotnet workload restore + Tizen
- Remove DOTNET_VERSION_PREVIEW and preview SDK install step
- Update pipeline variables: SDK 10.0.103, Xcode 16.2, Emscripten 3.1.56
- Update Blazor csproj with net10.0 PackageReference
- Update all sample, test, utility, and cake files
- Clean up NuGet.config (remove old preview feeds)
- Add documentation/updating-dotnet-version.md upgrade checklist
- global.json: Use 10.0.100 with latestPatch so any 10.0.1xx SDK satisfies
  the constraint (CI agents have 10.0.102, not 10.0.103)
- All Dockerfiles: Update from .NET 8 to .NET 10 SDK
  - WASM: mcr.microsoft.com/dotnet/sdk:8.0 → 10.0
  - Linux/Alpine: DOTNET_SDK_VERSION=8.0 → 10.0
The workloadVersion field causes native builds (WinUI, etc.) to fail when
the pre-installed SDK version doesn't match the pinned workload version.
Native builds skip the SDK/workload install step but still need dotnet.

Managed builds get workloads via 'dotnet workload restore' which uses
the SDK's bundled manifests — no global.json pin needed.
dotnet workload restore requires a project/solution file but there is
none in the repo root. Revert to explicit dotnet workload install with
the specific workload IDs needed by the repo.
- Add DOTNET_WORKLOAD_VERSION variable (10.0.103) to azure-templates-variables.yml
- Pass to install-dotnet-workloads.ps1 via -WorkloadVersion parameter
- Script uses 'dotnet workload install --version' for reproducible workload sets
- Keep global.json clean (no workloadVersion) so native builds aren't affected
- Update documentation to reflect new approach
- Update DOTNET_WORKLOAD_TIZEN to 10.0.123 (latest available for 10.0.100 band)
- Pass --dotnet-target-version-band 10.0.100 to Samsung's install scripts
  since their LatestVersionMap doesn't have .NET 10 entries yet
.NET 10 Apple workloads use Xcode 26 unified SDK versioning:
- iOS/MacCatalyst/tvOS/macOS TPV: 18.0/15.0 → 26.0

SupportedOSPlatformVersion minimums bumped in .NET 9/10 workloads:
- iOS/tvOS: 10.0 → 12.2
- MacCatalyst: 13.1 → 15.0
- macOS: 10.14 → 12.0
The Samsung Tizen workload must be installed before 'dotnet workload install
--version' locks the SDK into workload-set mode. Reorder to install Tizen
first via Samsung scripts, then official workloads with version pinning.
…or device tests

- Remove --version from dotnet workload install to avoid workload-set mode
  which makes the SDK ignore Samsung Tizen manifests installed separately
- Update WindowsSdkPackageVersion from 10.0.19041.27 to 10.0.19041.38
  (required by WindowsAppSDK 1.7)
- Add explicit TPVs to MauiTargetFrameworksApp* (26.0 for Apple, 36.0 for
  Android) to avoid resolving to default TPV 26.2 which requires Xcode 26.2
- Update build.cake device test TFMs to match TPV-qualified forms
- Remove unused DOTNET_WORKLOAD_VERSION pipeline variable
- Force manifest update mode with 'dotnet workload config --update-mode
  manifests' before installing workloads. .NET 10 SDK auto-switches to
  workload-set mode which ignores Samsung Tizen manifests.
- Use --skip-manifest-update to prevent official workload install from
  downloading a workload set and overriding manifest mode.
- Install Tizen AFTER official workloads (order doesn't matter in manifest mode).
- Use net9.0 TFMs for iOS/MacCatalyst device tests because net10.0 Apple
  SDK packs (both 26.0 and 26.2) require Xcode 26.0+ which CI doesn't have.
- Add Previous TFMs to device test project so net9.0 builds are available.
Debug Tizen install: show manifest directory contents and dotnet
workload list before and after official workload install to understand
why Samsung.Tizen FrameworkReference is not recognized.
- Set buildExternals default to 155857 to skip native rebuilds
- SkiaSharp.Tests: Add TFMPrevious so device tests can reference it
  from net9.0 TFMs (NU1201: not compatible)
- SkiaSharp.Tests.Devices: Bump MacCatalyst min to 15.0 (workload minimum)
Tizen SDK 10.0.123 only defines KnownFrameworkReference for TPV 8.0+.
TPV 7.0 is listed as supported but has no Samsung.Tizen framework ref,
causing NETSDK1073 'Samsung.Tizen was not recognized'.
- Remove --skip-manifest-update from official workload install:
  The flag prevented downloading manifests, so workloads had nothing
  to install (empty 'Successfully installed workload(s) .' output).
- Fix WASM AOT P/Invoke type conflict: Test used int/int signature
  for hb_script_get_horizontal_direction but binding uses uint/Direction.
  .NET 10 WASM AOT compiler flags this as a C-level type conflict.
The HarfBuzzSharp binding declares Direction as int-backed enum with
uint32_t parameter. The test must match: int32_t return, uint32_t param.
Previous fix incorrectly used uint32_t for both.
MAUI 10.0.0 dropped Tizen support entirely - the NuGet package has no
net10.0-tizen* assemblies. Samsung Tizen 10.0.123 workload removed
KnownFrameworkReference for TPV 7.0 (needed by MAUI 9.0), making
net9.0-tizen7.0 MAUI builds impossible too.

Non-MAUI Tizen support (NativeAssets, bindings) still works with
net9.0-tizen8.0 and net10.0-tizen10.0.
- Remove Microsoft.Maui.Controls.Compatibility.Hosting from MAUI sample
  (namespace removed in MAUI 10.0)
- Remove Tizen from MAUI sample TargetFrameworks (MAUI 10 dropped Tizen)
- Update Tizen sample tizen-manifest.xml api-version to 13 (matches
  TPV 10.0 → API level 13 in Samsung SDK 10.0.123)
- Update Apple ref package names in UpdateDocs.cake for TPV 26.0
…e sample TFMs

- Block TypeScript recompilation in Blazor csproj to fix .NET 10 static web
  assets compression race condition (TypeScriptCompileBlocked=true)
- Update VERSIONS.txt: Apple ref pack names from net8.0_17.0 to net10.0_26.0,
  MAUI versions from 8.0.3 to 10.0.31, tvOS ref pack name updated
- Switch Apple sample apps (iOS, MacCatalyst, MAUI, Uno) to net9.0 TFMs since
  net10.0 Apple TFMs require Xcode 26.0+ (CI has Xcode 16.2)
With the .NET 10 SDK, bare net9.0-ios resolves to TPV 26.0 (not 18.0),
which requires Xcode 26.0. Explicit TPVs (net9.0-ios18.0, net9.0-maccatalyst18.0)
are needed to match the Xcode 16.2 available on CI.
iOS SDK 18.0 requires minimum SupportedOSPlatformVersion of 12.2.
The truncation-based comparison with (int)(v * pow) / pow doesn't
handle negative values correctly near precision boundaries.
For example, -4.9999995 truncates to -4.9999 (not -5.0), causing
false test failures.

This became apparent with .NET 9+ which changed Matrix4x4.CreateFromAxisAngle
to go through Quaternion, producing slightly different floating-point results.

Using Math.Round() is the correct approach for floating-point similarity
comparison.
- Add Apple TPV 26.0 unified SDK versioning note
- Add SupportedOSPlatformVersion section
- Add global.json rollForward and workloadVersion warnings
- Add Docker images section
- Add Known Issues section (floating-point precision, Apple TPVs, MAUI breaking changes)
- Add CI Troubleshooting section (artifact reuse, SDK mismatch, workload install)
- Update workload pinning explanation
- nuget.org is disallowed in CI, must be removed before merging
- buildExternals must be reset to 'latest' before merging
- Add note about temporarily adding nuget.org during development
XyzCanInverts and AdobeRGB1998IsRGB tests fail with PRECISION=4 due to
floating-point differences in matrix operations across .NET versions.
Reduce to precision 3 which is sufficient for these colorspace tests.
mattleibow and others added 2 commits March 10, 2026 23:50
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Android uses circular adaptive icons so the foreground needs to be smaller
(0.90) to avoid clipping. iOS uses rounded-square icons with more space,
so the foreground can be larger (1.30) to fill the icon better.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Convert all block-scoped namespaces to file-scoped namespaces
- Convert space indentation to tabs per .editorconfig
- Remove trailing whitespace

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow changed the base branch from main to update/dotnet-10 March 10, 2026 22:38
Screenshots taken on iPhone 17 simulator (iOS 26.2) in light mode.
Added screenshots section to README.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Base automatically changed from update/dotnet-10 to main March 13, 2026 14:34
mattleibow and others added 2 commits March 13, 2026 16:50
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The tvOS native build was combining device and simulator binaries into a
single fat framework at output/native/tvos/, while the NuGet packaging
only included runtimes/tvos/native/ — missing runtimes/tvossimulator/.
This caused linker errors when building for tvOS simulator.

Changes:
- native/tvos/build.cake: Split output into tvos/ and tvossimulator/
  directories, add ios_use_simulator flag, pass SKIA_PLATFORM property
- SkiaSharp.NativeAssets.tvOS.csproj: Add tvossimulator PackageFile
- HarfBuzzSharp.NativeAssets.tvOS.csproj: Add tvossimulator PackageFile

This mirrors the proven iOS build pattern that already correctly splits
device (ios/) and simulator (iossimulator/) native assets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mattleibow and others added 17 commits March 13, 2026 23:39
The tvOS build was incorrectly passing min_ios_version to GnNinja, which set
the iOS deployment target but left the tvOS deployment target at Skia's default
of 9.0. This changes it to min_tvos_version so the -mtvos-version-min flag is
set correctly to 11.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…icate Dispose

- Uno: Remove manual PackageReference for SkiaSharp.Views.Uno.WinUI that
  conflicted with the samples-generate ProjectReference→PackageReference
  conversion, causing 'Sequence contains more than one matching element'
- WinForms: Merge GpuPage Dispose into Designer.cs (was defined in both
  GpuPage.cs and GpuPage.Designer.cs causing CS0111)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…reference

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…r changes

- Add nuget.org as package source in nuget.config
- Update Uno.WinUI from 5.6.99 to 6.5.153 in source/ projects
- Update Uno.WinUI from 5.2.175 to 6.5.153 in VERSIONS.txt
- Update Uno.UI from 4.0.8 to 5.6.99 in Gallery/Uno samples
- Revert azure-pipelines-complete.yml to main (no build changes yet)
- Revert SkiaSharp.Views.Blazor.csproj to main (fixed upstream)
- Delete screenshots/ folder (not tracked in repo)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Uno.WinUI 6.x removed/changed IsOpaque and DrawRect(CGRect) overrides
on the macOS backend, causing CS0115 build failures in SKXamlCanvas.
The source/ packages must stay on the version from main until the Uno
API changes are properly addressed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Uno 6.x dropped the native macOS (net*-macos) target framework entirely.
macOS desktop is now served via the Skia renderer using the plain net*
TFM (same as Linux desktop). Remove -macos from UnoTargetFrameworks to
match.

The macOS-specific files (SKXamlCanvas.macOS.cs, SKGLView.cs for macOS)
are already conditionally compiled only when the TFM contains '-macos',
so they are automatically excluded with no further changes needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
All Uno-related changes (sample pages, source Uno.WinUI update,
Build.props TFM changes, VERSIONS.txt) have been moved to a
dedicated PR #3565 to keep this samples PR focused on the other
platform samples.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update Microsoft.WindowsAppSDK to 1.8.260317003 (latest stable)
- Switch NavigationView from sidebar to top tabs (PaneDisplayMode=Top)
- Add WindowsPackageType=None for unpackaged deployment
- GPU page: FPS pill overlay (centered top), Loaded/Unloaded lifecycle
- GPU page: reuse SKPaint field, fix TextBlock Background (WinUI incompatible)
- Drawing page: adaptive layout with VisualStateManager/AdaptiveTrigger
- Drawing page: theme-aware swatch colors that update on theme change
- Drawing page: DodgerBlue selection highlight matching Maui
- MainWindow: clear back stack on tab switch to stop GPU render loop
- Add 6 screenshots (light/dark for CPU, GPU, Drawing)
- Update README with features, requirements, screenshot table

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Switch from sidebar ListBox to TabControl top tabs
- GPU page: FPS pill overlay (centered top, matching Maui/WinUI)
- GPU page: reuse SKPaint field, non-nullable Lazy, StartAnimation/StopAnimation
- Drawing page: theme-aware swatch colors via ApplySwatchColors()
- Drawing page: DodgerBlue selection highlight matching Maui/WinUI
- Drawing page: WrapPanel for adaptive toolbox layout
- Drawing page: 36x36 swatches with CornerRadius 18 matching Maui/WinUI
- Simplified MainWindow with lazy tab content creation
- Add 6 screenshots (light/dark for CPU, GPU, Drawing)
- Update README with features, .NET 10 requirements, screenshot table

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add ThemeMode=System to App.xaml for WPF Fluent theme (.NET 9+)
- Suppress WPF0001 to use ThemeMode API in code
- DrawingPage: use Window.ThemeMode for dark mode detection (falls back to registry)
- Retake all screenshots with Fluent chrome (dark title bar, dark tabs)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix drawing/GPU pages losing mouse input on Fluent theme switch
  (move event subscriptions from constructor to Loaded/Unloaded)
- Clean up code: proper usings, collection expressions, target-typed new
- Remove fully-qualified System.Windows.Media references
- Consistent access modifiers (drop redundant private)
- Brush indicator uses currentColor.WithAlpha(128) matching WinUI
- IsDarkMode refactored to method at bottom of file
- Retake all 6 screenshots with clean backgrounds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…shots

Sample changes:
- Enable dark mode via Application.SetColorMode(SystemColorMode.System)
- Switch from sidebar ListBox to TabControl top tabs
- GPU page: centered FPS pill overlay
- DrawingPage: FlowLayoutPanel with Anchor=Bottom for auto-centering toolbox
- DrawingPage: Clear button with Anchor=Top|Right
- DrawingPage: all controls defined in Designer.cs (drag-and-drop editable)
- DrawingPage: theme-aware swatch colors, DodgerBlue selection
- Form1: lazy tab content, deferred to Shown event for proper SKControl init
- Larger default window size (1100x700)
- Suppress WFO5001 for experimental dark mode API
- Add 6 screenshots (light/dark for CPU, GPU, Drawing)
- Update README with features, .NET 10, screenshot table

SKControl/SKGLControl fix:
- Fix VS Designer crash: use live DesignMode property instead of
  constructor-cached field (DesignMode is False during construction
  but True at paint time in the DesignToolsServer process)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant