Repository navigation
feat: TitleBar UI - #21917
feat: TitleBar UI#21917
TitleBar UI#21917Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces the TitleBar UI control implementation for the Uno Platform, providing a customizable title bar component for windowing scenarios. The implementation includes core control classes, dependency properties, automation support, and sample pages for testing and demonstration.
Key Changes
- New
TitleBarcontrol with support for icons, titles, subtitles, headers, and custom content areas - Automation peer implementation for accessibility
- Template settings for data binding
- Integration with window management APIs for proper padding and non-client region handling
- Sample pages demonstrating TitleBar usage in both standalone and window contexts
Reviewed changes
Copilot reviewed 12 out of 15 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
TitleBar.cs |
Main partial class declaration with ContentProperty attribute |
TitleBar.Properties.cs |
Dependency property definitions for all TitleBar properties and events |
TitleBar.mux.cs |
Core implementation with lifecycle methods, event handlers, and UI update logic |
TitleBar.mux.h.cs |
Private fields, constants for template parts and visual states |
TitleBarTemplateSettings.cs |
Template settings class for IconElement binding |
TitleBarAutomationPeer.cs |
Automation peer for accessibility support |
Generated/.../TitleBar.cs |
Generated stub file with conditional compilation updated to enable implementation |
Generated/.../TitleBarTemplateSettings.cs |
Generated template settings stub updated |
Generated/.../TitleBarAutomationPeer.cs |
Generated automation peer stub updated |
ResourceAccessor.ResourceKeys.cs |
Added resource key for pane toggle button name |
TitleBarPage.xaml/.cs |
Sample page demonstrating basic TitleBar usage |
TitleBarPageWindow.xaml/.cs |
Window sample with comprehensive TitleBar configuration options |
UITests.Shared.projitems |
Project file updated to include new test pages |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21917/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21917/wasm-skia-net9/index.html |
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days. |
|
This PR was closed because it has been stalled for 10 days with no activity. |
76dd267 to
52b81a6
Compare
XAML Styler drift detected on
|
WinAppSDK sync generator drift detected on
|
XAML Styler drift detected on
|
WinAppSDK sync generator drift detected on
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 15 comments.
Comments suppressed due to low confidence (2)
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/TitleBarTests/TitleBarPageWindow.xaml.cs:7
System.Diagnosticsis imported but not used in this file. With TreatWarningsAsErrors, this unused using will fail the build; remove it or use the referenced types.
using System.Diagnostics;
src/Uno.UI/UI/Xaml/Controls/TitleBar/TitleBar.mux.cs:589
- The coordinate validity check uses
X >= 0 || Y >= 0, which will accept rects with a negative X or negative Y. Require both coordinates to be non-negative (or skip if either is negative) before adding the icon rect.
var iconRect = GetBounds(iconViewbox);
if (iconRect.X >= 0 || iconRect.Y >= 0)
{
iconRects.Add(iconRect);
7dffaf2 to
c562aff
Compare
XAML Styler drift detected on
|
WinAppSDK sync generator drift detected on
|
c562aff to
687854d
Compare
Sync the TitleBar control with the latest WinUI C++ sources, porting the drift between commit 5f9e85113 and fc2f82117: - Add AutoRefreshDragRegions DP and the IsDragRegion attached property (GetIsDragRegion/SetIsDragRegion) plus RecomputeDragRegions(). - Port FindInteractableElements recursive drag-region detection, replacing the flat content-area registration in UpdateInteractableElementsList. - Port app-window title sync (UpdateTitle/ResetTitle/HandleTitleChange) and the cached TryGetAppWindow helper. - Port OnContentLayoutUpdated one-shot/auto-refresh layout tracking and the passthrough-rects caching in UpdateDragRegion. - Fix the OnPropertyChanged else-if chain and add the AutoRefreshDragRegions branch. Also make the in-progress port build: - Reconcile the TitleBar and TitleBarTemplateSettings generated stubs to the implemented form (#if false guards) so they no longer collide with the hand-written implementation. - Register the FlowDirection changed callback via RegisterPropertyChangedCallback so the (DependencyObject, DependencyProperty) handler signature matches. Validated: Uno.UI.Skia builds clean; adversarial multi-agent review found no fidelity divergences from the C++ source. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Capture activation listener in a local in OnApplyTemplate so the revoker unsubscribes from the correct instance on template re-apply - Return string.Empty fallback from TitleBarAutomationPeer.GetNameCore to preserve WinUI's non-null name contract - Remove unused usings and document Win32 constants in TitleBar samples Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Regenerate themeresources_v2.xaml to include the TitleBar style and theme brushes (the BatchMergeXaml output was missing them), fixing the Given_Control.When_Non_BuiltIn_Control default-style lookup - Remove unused s_layoutRootPartName const (IDE0051); WinUI declares it but never retrieves PART_LayoutRoot, so it is dead here too Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
WinUI revokes the InputActivationListener subscription in the C++ ~TitleBar destructor. Uno has no deterministic finalizer, so the subscription is now attached on Loaded and detached on Unloaded (reattaching on re-add), preventing the listener from rooting the TitleBar once the API is implemented. ResetTitle-on-GC is left out deliberately to avoid window-title flicker on tree detach. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0146Uxqo6gG5TzZv5bBvRZK9
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0146Uxqo6gG5TzZv5bBvRZK9
Mark the IsDragRegionProperty getter with [DynamicDependency] for GetIsDragRegion/SetIsDragRegion so WASM/NativeAOT trimming preserves the attached-property accessors used by XAML. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0146Uxqo6gG5TzZv5bBvRZK9
UITests.Shared compiles into every head and the Skia head runs on macOS/Linux; guard the user32.dll caption-button swap with a runtime OperatingSystem.IsWindows() check to avoid DllNotFoundException. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0146Uxqo6gG5TzZv5bBvRZK9
89395d0 to
b12f784
Compare
|
Claude finished @MartinZikmund's task in 4m 51s —— View job Code Review Complete
SummaryAll medium-severity findings from prior review rounds are resolved in the latest commits. The implementation is clean for merge. Fixed in recent commits (confirmed):
0 new inline findings this round. The code is clean. Intentional won't-fix (confirmed 1:1 WinUI port):
Cross-cutting carry-over: No automated runtime tests cover the new |
WinAppSDK sync generator drift detected on
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21917/wasm-skia-net9/index.html |
|
/apply-sync-gen |
|
The apply workflow failed. See the workflow logs for details. |
|
Claude finished @MartinZikmund's task in 4m 41s —— View job Code Review Complete
SummaryThe two new commits since the last review round are correct and clean.
0 new inline findings this round. All medium-severity issues from prior rounds remain fixed. Confirmed won't-fix (intentional 1:1 WinUI port):
Cross-cutting carry-over: No automated runtime tests cover the new |
|
Claude finished @MartinZikmund's task in 2m 21s —— View job Code Review Complete
SummaryThe two commits pushed since the July 30 review (
Both evaluate identically ( 0 new findings this round. The implementation remains clean. All findings from prior rounds confirmed resolved:
Intentional won't-fix (confirmed 1:1 WinUI port):
Cross-cutting carry-over: No automated runtime tests cover the new |
WinAppSDK sync generator drift detected on
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21917/wasm-skia-net9/index.html |
|
The build 224945 found UI Test snapshots differences: Details
|
|
Tick the box to add this pull request to the merge queue (same as
|
GitHub Issue: closes #21714
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️