From 1cd12b11bdc4ec65997ff45bfd82a98684b537c7 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 10 Nov 2025 11:49:39 +0000
Subject: [PATCH 1/4] Initial plan
From 88529fd2af8570fe3cb3a90f651c71be4738d194 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 10 Nov 2025 11:59:51 +0000
Subject: [PATCH 2/4] Add three new windowing samples demonstrating advanced
APIs
Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
---
UI/WindowingSamples/README.md | 3 +
.../CustomTitleBarWindow.xaml | 104 ++++++++++++
.../CustomTitleBarWindow.xaml.cs | 149 ++++++++++++++++++
.../DraggableRegionWindow.xaml | 126 +++++++++++++++
.../DraggableRegionWindow.xaml.cs | 81 ++++++++++
.../ExtendContentIntoTitleBarWindow.xaml | 58 +++++++
.../ExtendContentIntoTitleBarWindow.xaml.cs | 25 +++
.../src/WindowingSamples/MainPage.xaml | 18 +++
.../src/WindowingSamples/MainPage.xaml.cs | 6 +
9 files changed, 570 insertions(+)
create mode 100644 UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml
create mode 100644 UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml.cs
create mode 100644 UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml
create mode 100644 UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml.cs
create mode 100644 UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml
create mode 100644 UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs
diff --git a/UI/WindowingSamples/README.md b/UI/WindowingSamples/README.md
index 5b549a94c..63b37ddae 100644
--- a/UI/WindowingSamples/README.md
+++ b/UI/WindowingSamples/README.md
@@ -13,6 +13,9 @@ Most windowing features are currently available on desktop targets of [Uno Platf
* [**MinimizeMaximizeWindow.xaml & MinimizeMaximizeWindow.xaml.cs**](src/WindowingSamples/MinimizeMaximizeWindow.xaml.cs): Minimizing and maximizing a window.
* [**StayOnTopWindow.xaml & StayOnTopWindow.xaml.cs**](src/WindowingSamples/StayOnTopWindow.xaml.cs): Window that always stays on top of other content.
* [**WindowTitleWindow.xaml & WindowTitleWindow.xaml.cs**](src/WindowingSamples/WindowTitleWindow.xaml.cs): Customizing the Window title.
+* [**ExtendContentIntoTitleBarWindow.xaml & ExtendContentIntoTitleBarWindow.xaml.cs**](src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs): Demonstrating `Window.ExtendsContentIntoTitleBar` API to extend XAML UI into the titlebar area while preserving the caption buttons.
+* [**CustomTitleBarWindow.xaml & CustomTitleBarWindow.xaml.cs**](src/WindowingSamples/CustomTitleBarWindow.xaml.cs): Demonstrating `SetBorderAndTitleBar(true, false)` API to completely extend the client area and hide the caption buttons, with custom caption buttons and `InputNonClientPointerSource.SetRegionRects` for the Maximize button to support Snap layouts menu.
+* [**DraggableRegionWindow.xaml & DraggableRegionWindow.xaml.cs**](src/WindowingSamples/DraggableRegionWindow.xaml.cs): Demonstrating `InputNonClientPointerSource.SetRegionRects` for Caption region to create custom draggable regions in the window.
## What is the Uno Platform
diff --git a/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml b/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml
new file mode 100644
index 000000000..d759e20d4
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SetBorderAndTitleBar(true, false) Demo
+
+
+ This window demonstrates the SetBorderAndTitleBar API with parameters (true, false) to completely extend the client area and hide the system caption buttons. The window has fully custom caption buttons that you can style as needed.
+
+
+
+
+
+ • Full control over window appearance
+ • Custom caption buttons (minimize, maximize/restore, close)
+ • SetBorderAndTitleBar(true, false) hides system buttons
+ • Custom button styling and behavior
+
+
+
+
+
+
+
+ The Maximize button uses InputNonClientPointerSource.SetRegionRects to support the Snap Layouts menu on Windows 11. When you hover over the maximize button, you'll see the snap layout options appear.
+
+
+ Note: This feature requires Windows 11 and will be a no-op on other platforms.
+
+
+
+
+
+
+
+ • Click the minimize button to minimize the window
+ • Click the maximize button to maximize or restore the window
+ • Hover over maximize button on Windows 11 to see Snap Layouts
+ • Click the close button (red on hover) to close the window
+ • Drag the title bar to move the window
+
+
+
+
+
+
diff --git a/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml.cs b/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml.cs
new file mode 100644
index 000000000..8a213951b
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml.cs
@@ -0,0 +1,149 @@
+using Microsoft.UI.Windowing;
+using Microsoft.UI.Input;
+using Windows.Graphics;
+
+namespace WindowingSamples;
+
+///
+/// Window demonstrating SetBorderAndTitleBar(true, false) API with custom caption buttons.
+/// Also demonstrates InputNonClientPointerSource.SetRegionRects for Maximize button to support Snap Layouts.
+///
+public sealed partial class CustomTitleBarWindow : Window
+{
+ private AppWindow? _appWindow;
+ private InputNonClientPointerSource? _nonClientPointerSource;
+
+ public CustomTitleBarWindow()
+ {
+ InitializeComponent();
+
+ Title = "Custom Title Bar with Caption Buttons";
+
+ // Get AppWindow
+ _appWindow = AppWindow;
+
+ if (_appWindow is not null)
+ {
+ // SetBorderAndTitleBar with (true, false) to extend client area and hide system caption buttons
+ _appWindow.SetBorderAndTitleBar(hasBorder: true, hasTitleBar: false);
+
+ // Set the drag region for the custom title bar
+ SetTitleBar(CustomTitleBar);
+
+ // Configure InputNonClientPointerSource for Maximize button to support Snap Layouts
+ ConfigureMaximizeButtonSnapLayouts();
+
+ // Update maximize/restore icon based on current state
+ UpdateMaximizeRestoreIcon();
+
+ // Subscribe to window state changes
+ _appWindow.Changed += OnAppWindowChanged;
+ }
+
+ // Update icon when window state changes
+ SizeChanged += (s, e) => UpdateMaximizeRestoreIcon();
+ }
+
+ private void ConfigureMaximizeButtonSnapLayouts()
+ {
+ if (_appWindow is null || MaximizeRestoreButton is null)
+ return;
+
+ try
+ {
+ // Get the InputNonClientPointerSource for non-client area input
+ _nonClientPointerSource = InputNonClientPointerSource.GetForWindowId(_appWindow.Id);
+
+ if (_nonClientPointerSource is not null)
+ {
+ // Update the region when the button is loaded or size changes
+ MaximizeRestoreButton.Loaded += (s, e) => UpdateMaximizeButtonRegion();
+ MaximizeRestoreButton.SizeChanged += (s, e) => UpdateMaximizeButtonRegion();
+ }
+ }
+ catch
+ {
+ // InputNonClientPointerSource may not be available on all platforms
+ // This is expected and we can safely ignore
+ }
+ }
+
+ private void UpdateMaximizeButtonRegion()
+ {
+ if (_nonClientPointerSource is null || MaximizeRestoreButton is null || _appWindow is null)
+ return;
+
+ try
+ {
+ // Get the button's position relative to the window
+ var transform = MaximizeRestoreButton.TransformToVisual(null);
+ var buttonPosition = transform.TransformPoint(new Windows.Foundation.Point(0, 0));
+
+ var scale = (float)_appWindow.ClientSize.Width / (float)Content.ActualSize.X;
+
+ // Create a rect for the maximize button region
+ var rect = new RectInt32(
+ _X: (int)(buttonPosition.X * scale),
+ _Y: (int)(buttonPosition.Y * scale),
+ _Width: (int)(MaximizeRestoreButton.ActualWidth * scale),
+ _Height: (int)(MaximizeRestoreButton.ActualHeight * scale)
+ );
+
+ // Set the region for the Maximize button to enable Snap Layouts
+ _nonClientPointerSource.SetRegionRects(NonClientRegionKind.Passthrough, new[] { rect });
+ }
+ catch
+ {
+ // SetRegionRects may fail on some platforms or configurations
+ // This is expected and we can safely ignore
+ }
+ }
+
+ private void OnAppWindowChanged(AppWindow sender, AppWindowChangedEventArgs args)
+ {
+ if (args.DidPresenterChange)
+ {
+ UpdateMaximizeRestoreIcon();
+ }
+ }
+
+ private void UpdateMaximizeRestoreIcon()
+ {
+ if (_appWindow is null || MaximizeRestoreIcon is null)
+ return;
+
+ // Update icon based on window state
+ var isMaximized = _appWindow.Presenter.Kind == AppWindowPresenterKind.FullScreen ||
+ (_appWindow.Presenter is OverlappedPresenter overlapped && overlapped.State == OverlappedPresenterState.Maximized);
+
+ MaximizeRestoreIcon.Glyph = isMaximized ? "\uE923" : "\uE922"; // Restore or Maximize icon
+
+ var tooltip = isMaximized ? "Restore Down" : "Maximize";
+ ToolTipService.SetToolTip(MaximizeRestoreButton, tooltip);
+ }
+
+ private void MinimizeClick(object sender, RoutedEventArgs args)
+ {
+ if (_appWindow?.Presenter is OverlappedPresenter presenter)
+ {
+ presenter.Minimize();
+ }
+ }
+
+ private void MaximizeRestoreClick(object sender, RoutedEventArgs args)
+ {
+ if (_appWindow?.Presenter is OverlappedPresenter presenter)
+ {
+ if (presenter.State == OverlappedPresenterState.Maximized)
+ {
+ presenter.Restore();
+ }
+ else
+ {
+ presenter.Maximize();
+ }
+ }
+ }
+
+ public void CloseClick(object sender, RoutedEventArgs args) => Close();
+}
diff --git a/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml b/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml
new file mode 100644
index 000000000..b03360623
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ InputNonClientPointerSource.SetRegionRects for Caption
+
+
+ This window demonstrates the usage of InputNonClientPointerSource.SetRegionRects for the Caption region kind. The red rectangle in the middle of the window can be used to drag the entire window around the screen.
+
+
+
+
+
+
+ • The red rectangle is defined as a non-client caption region using SetRegionRects
+
+
+ • When you click and drag the red area, the window moves as if you were dragging the title bar
+
+
+ • This demonstrates custom drag regions anywhere in your window
+
+
+ • The region automatically updates when the window is resized or the element moves
+
+
+
+
+
+
+
+
+ InputNonClientPointerSource.SetRegionRects
+
+ This API allows you to define custom regions in your window that behave like non-client areas (such as the title bar for dragging, or the resize borders).
+
+
+ NonClientRegionKind.Caption
+
+ When you set a region as Caption, clicking and dragging in that region will move the entire window.
+
+
+
+
+
+
+
+ • Custom title bar layouts with specific draggable areas
+ • Media player controls where only certain areas allow window dragging
+ • Design tools where you want precise control over draggable regions
+ • Floating toolbars or panels with custom drag handles
+
+
+
+
+
+
+
+
+
diff --git a/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml.cs b/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml.cs
new file mode 100644
index 000000000..df6f3d520
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml.cs
@@ -0,0 +1,81 @@
+using Microsoft.UI.Windowing;
+using Microsoft.UI.Input;
+using Windows.Graphics;
+
+namespace WindowingSamples;
+
+///
+/// Window demonstrating InputNonClientPointerSource.SetRegionRects for Caption region.
+/// This shows how to create a custom draggable region in the middle of the window.
+///
+public sealed partial class DraggableRegionWindow : Window
+{
+ private AppWindow? _appWindow;
+ private InputNonClientPointerSource? _nonClientPointerSource;
+
+ public DraggableRegionWindow()
+ {
+ InitializeComponent();
+
+ Title = "Draggable Region Demo";
+
+ // Get AppWindow
+ _appWindow = AppWindow;
+
+ if (_appWindow is not null)
+ {
+ // Get the InputNonClientPointerSource for non-client area input
+ try
+ {
+ _nonClientPointerSource = InputNonClientPointerSource.GetForWindowId(_appWindow.Id);
+
+ if (_nonClientPointerSource is not null)
+ {
+ // Update the draggable region when the element is loaded or resized
+ DraggableRegion.Loaded += (s, e) => UpdateDraggableRegion();
+ DraggableRegion.SizeChanged += (s, e) => UpdateDraggableRegion();
+ SizeChanged += (s, e) => UpdateDraggableRegion();
+ }
+ }
+ catch
+ {
+ // InputNonClientPointerSource may not be available on all platforms
+ // This is expected and we can safely ignore
+ }
+ }
+ }
+
+ private void UpdateDraggableRegion()
+ {
+ if (_nonClientPointerSource is null || DraggableRegion is null || _appWindow is null)
+ return;
+
+ try
+ {
+ // Get the draggable region's position relative to the window
+ var transform = DraggableRegion.TransformToVisual(null);
+ var position = transform.TransformPoint(new Windows.Foundation.Point(0, 0));
+
+ // Calculate scale factor between logical and physical pixels
+ var scale = (float)_appWindow.ClientSize.Width / (float)Content.ActualSize.X;
+
+ // Create a rect for the draggable region
+ var rect = new RectInt32(
+ _X: (int)(position.X * scale),
+ _Y: (int)(position.Y * scale),
+ _Width: (int)(DraggableRegion.ActualWidth * scale),
+ _Height: (int)(DraggableRegion.ActualHeight * scale)
+ );
+
+ // Set the region as a Caption region (draggable)
+ _nonClientPointerSource.SetRegionRects(NonClientRegionKind.Caption, new[] { rect });
+ }
+ catch
+ {
+ // SetRegionRects may fail on some platforms or configurations
+ // This is expected and we can safely ignore
+ }
+ }
+
+ public void CloseClick(object sender, RoutedEventArgs args) => Close();
+}
diff --git a/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml b/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml
new file mode 100644
index 000000000..555e13533
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ExtendsContentIntoTitleBar Demo
+
+
+ This window demonstrates the ExtendsContentIntoTitleBar API which allows extending XAML UI into the title bar area while preserving the caption buttons (minimize, maximize, close).
+
+
+ Notice the custom title bar at the top with the icon, text, and logo - this area is part of the window's content but appears in the title bar region.
+
+
+
+
+
+ • Custom UI in title bar area
+ • System caption buttons remain visible and functional
+ • Supports drag-to-move from title bar
+ • Maintains native window behaviors
+
+
+
+
+
+
+
diff --git a/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs b/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs
new file mode 100644
index 000000000..4d4a4739e
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs
@@ -0,0 +1,25 @@
+using Microsoft.UI.Windowing;
+
+namespace WindowingSamples;
+
+///
+/// Window demonstrating ExtendsContentIntoTitleBar API.
+/// This API allows extending XAML UI into the title bar area while preserving caption buttons.
+///
+public sealed partial class ExtendContentIntoTitleBarWindow : Window
+{
+ public ExtendContentIntoTitleBarWindow()
+ {
+ InitializeComponent();
+
+ Title = "Extend Content Into Title Bar";
+
+ // Enable extending content into title bar
+ ExtendsContentIntoTitleBar = true;
+
+ // Set the custom title bar element for drag region
+ SetTitleBar(CustomTitleBar);
+ }
+
+ public void CloseClick(object sender, RoutedEventArgs args) => Close();
+}
diff --git a/UI/WindowingSamples/src/WindowingSamples/MainPage.xaml b/UI/WindowingSamples/src/WindowingSamples/MainPage.xaml
index bac88f8e7..df22cfef4 100644
--- a/UI/WindowingSamples/src/WindowingSamples/MainPage.xaml
+++ b/UI/WindowingSamples/src/WindowingSamples/MainPage.xaml
@@ -53,5 +53,23 @@
+
+
+
diff --git a/UI/WindowingSamples/src/WindowingSamples/MainPage.xaml.cs b/UI/WindowingSamples/src/WindowingSamples/MainPage.xaml.cs
index 87e838116..168e27308 100644
--- a/UI/WindowingSamples/src/WindowingSamples/MainPage.xaml.cs
+++ b/UI/WindowingSamples/src/WindowingSamples/MainPage.xaml.cs
@@ -43,4 +43,10 @@ public void BasicWindowSample()
public void WindowTitleSample() => new WindowTitleWindow().Activate();
public void StayOnTopSample() => new StayOnTopWindow().Activate();
+
+ public void ExtendContentIntoTitleBarSample() => new ExtendContentIntoTitleBarWindow().Activate();
+
+ public void CustomTitleBarSample() => new CustomTitleBarWindow().Activate();
+
+ public void DraggableRegionSample() => new DraggableRegionWindow().Activate();
}
From 6a194f5b9c5588b608b4f6c62d66dd81a50b6e94 Mon Sep 17 00:00:00 2001
From: Martin Zikmund
Date: Mon, 10 Nov 2025 13:43:24 +0100
Subject: [PATCH 3/4] chore: Adjust samples for Uno support
---
.../CustomTitleBarWindow.xaml.cs | 21 +++++++++--------
.../DraggableRegionWindow.xaml.cs | 15 ++++++------
.../ExtendContentIntoTitleBarWindow.xaml.cs | 6 ++---
.../Platforms/Desktop/Program.cs | 5 ++--
.../PublishProfiles/win-arm64.pubxml | 23 +++++++++++++++++++
.../Properties/PublishProfiles/win-x64.pubxml | 23 +++++++++++++++++++
.../Properties/PublishProfiles/win-x86.pubxml | 23 +++++++++++++++++++
.../WindowingSamples/WindowingSamples.csproj | 4 ++--
UI/WindowingSamples/src/global.json | 2 +-
9 files changed, 96 insertions(+), 26 deletions(-)
create mode 100644 UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-arm64.pubxml
create mode 100644 UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-x64.pubxml
create mode 100644 UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-x86.pubxml
diff --git a/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml.cs b/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml.cs
index 8a213951b..ae705fd54 100644
--- a/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml.cs
+++ b/UI/WindowingSamples/src/WindowingSamples/CustomTitleBarWindow.xaml.cs
@@ -25,7 +25,8 @@ public CustomTitleBarWindow()
if (_appWindow is not null)
{
// SetBorderAndTitleBar with (true, false) to extend client area and hide system caption buttons
- _appWindow.SetBorderAndTitleBar(hasBorder: true, hasTitleBar: false);
+ var presenter = _appWindow.Presenter as OverlappedPresenter;
+ presenter.SetBorderAndTitleBar(hasBorder: true, hasTitleBar: false);
// Set the drag region for the custom title bar
SetTitleBar(CustomTitleBar);
@@ -57,6 +58,7 @@ private void ConfigureMaximizeButtonSnapLayouts()
if (_nonClientPointerSource is not null)
{
// Update the region when the button is loaded or size changes
+ _appWindow.Changed += (s, e) => UpdateMaximizeButtonRegion();
MaximizeRestoreButton.Loaded += (s, e) => UpdateMaximizeButtonRegion();
MaximizeRestoreButton.SizeChanged += (s, e) => UpdateMaximizeButtonRegion();
}
@@ -78,19 +80,18 @@ private void UpdateMaximizeButtonRegion()
// Get the button's position relative to the window
var transform = MaximizeRestoreButton.TransformToVisual(null);
var buttonPosition = transform.TransformPoint(new Windows.Foundation.Point(0, 0));
-
- var scale = (float)_appWindow.ClientSize.Width / (float)Content.ActualSize.X;
+ var scale = (float)_appWindow.Size.Width / (float)Content.ActualSize.X;
// Create a rect for the maximize button region
- var rect = new RectInt32(
- _X: (int)(buttonPosition.X * scale),
- _Y: (int)(buttonPosition.Y * scale),
- _Width: (int)(MaximizeRestoreButton.ActualWidth * scale),
- _Height: (int)(MaximizeRestoreButton.ActualHeight * scale)
- );
+ var rect = new RectInt32() {
+ X = (int)(buttonPosition.X * scale),
+ Y = (int)(buttonPosition.Y * scale),
+ Width = (int)(MaximizeRestoreButton.ActualWidth * scale),
+ Height = (int)(MaximizeRestoreButton.ActualHeight * scale)
+ };
// Set the region for the Maximize button to enable Snap Layouts
- _nonClientPointerSource.SetRegionRects(NonClientRegionKind.Passthrough, new[] { rect });
+ _nonClientPointerSource.SetRegionRects(NonClientRegionKind.Maximize, new[] { rect });
}
catch
{
diff --git a/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml.cs b/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml.cs
index df6f3d520..83ba4a8e9 100644
--- a/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml.cs
+++ b/UI/WindowingSamples/src/WindowingSamples/DraggableRegionWindow.xaml.cs
@@ -1,5 +1,5 @@
-using Microsoft.UI.Windowing;
using Microsoft.UI.Input;
+using Microsoft.UI.Windowing;
using Windows.Graphics;
namespace WindowingSamples;
@@ -60,12 +60,13 @@ private void UpdateDraggableRegion()
var scale = (float)_appWindow.ClientSize.Width / (float)Content.ActualSize.X;
// Create a rect for the draggable region
- var rect = new RectInt32(
- _X: (int)(position.X * scale),
- _Y: (int)(position.Y * scale),
- _Width: (int)(DraggableRegion.ActualWidth * scale),
- _Height: (int)(DraggableRegion.ActualHeight * scale)
- );
+ var rect = new RectInt32()
+ {
+ X = (int)(position.X * scale),
+ Y = (int)(position.Y * scale),
+ Width = (int)(DraggableRegion.ActualWidth * scale),
+ Height = (int)(DraggableRegion.ActualHeight * scale)
+ };
// Set the region as a Caption region (draggable)
_nonClientPointerSource.SetRegionRects(NonClientRegionKind.Caption, new[] { rect });
diff --git a/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs b/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs
index 4d4a4739e..1c02ae3ac 100644
--- a/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs
+++ b/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml.cs
@@ -15,10 +15,8 @@ public ExtendContentIntoTitleBarWindow()
Title = "Extend Content Into Title Bar";
// Enable extending content into title bar
- ExtendsContentIntoTitleBar = true;
-
- // Set the custom title bar element for drag region
- SetTitleBar(CustomTitleBar);
+ AppWindow.TitleBar.ExtendsContentIntoTitleBar = true;
+ AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Tall;
}
public void CloseClick(object sender, RoutedEventArgs args) => Close();
diff --git a/UI/WindowingSamples/src/WindowingSamples/Platforms/Desktop/Program.cs b/UI/WindowingSamples/src/WindowingSamples/Platforms/Desktop/Program.cs
index fe385cb69..56e250beb 100644
--- a/UI/WindowingSamples/src/WindowingSamples/Platforms/Desktop/Program.cs
+++ b/UI/WindowingSamples/src/WindowingSamples/Platforms/Desktop/Program.cs
@@ -1,3 +1,4 @@
+using Uno.UI.Hosting;
using Uno.UI.Runtime.Skia;
namespace WindowingSamples;
@@ -10,12 +11,12 @@ public static void Main(string[] args)
App.InitializeLogging();
#endif
- var host = SkiaHostBuilder.Create()
+ var host = UnoPlatformHostBuilder.Create()
.App(() => new App())
.UseX11()
.UseLinuxFrameBuffer()
.UseMacOS()
- .UseWindows()
+ .UseWin32()
.Build();
host.Run();
diff --git a/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-arm64.pubxml b/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-arm64.pubxml
new file mode 100644
index 000000000..7b7a761ef
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-arm64.pubxml
@@ -0,0 +1,23 @@
+
+
+
+
+ FileSystem
+ arm64
+ win-arm64
+ bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\
+ true
+ False
+ False
+ True
+ False
+ True
+
+
+
diff --git a/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-x64.pubxml b/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-x64.pubxml
new file mode 100644
index 000000000..98f9a5373
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-x64.pubxml
@@ -0,0 +1,23 @@
+
+
+
+
+ FileSystem
+ x64
+ win-x64
+ bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\
+ true
+ False
+ False
+ True
+ False
+ True
+
+
+
diff --git a/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-x86.pubxml b/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-x86.pubxml
new file mode 100644
index 000000000..65b8f1db6
--- /dev/null
+++ b/UI/WindowingSamples/src/WindowingSamples/Properties/PublishProfiles/win-x86.pubxml
@@ -0,0 +1,23 @@
+
+
+
+
+ FileSystem
+ x86
+ win-x86
+ bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\
+ true
+ False
+ False
+ True
+ False
+ True
+
+
+
diff --git a/UI/WindowingSamples/src/WindowingSamples/WindowingSamples.csproj b/UI/WindowingSamples/src/WindowingSamples/WindowingSamples.csproj
index ebee88e84..5dcaaf519 100644
--- a/UI/WindowingSamples/src/WindowingSamples/WindowingSamples.csproj
+++ b/UI/WindowingSamples/src/WindowingSamples/WindowingSamples.csproj
@@ -1,8 +1,8 @@
- net8.0-windows10.0.19041;
- net8.0-desktop;
+ net9.0-windows10.0.26100;
+ net9.0-desktop;
Exe
diff --git a/UI/WindowingSamples/src/global.json b/UI/WindowingSamples/src/global.json
index 7f77770dc..90a411e82 100644
--- a/UI/WindowingSamples/src/global.json
+++ b/UI/WindowingSamples/src/global.json
@@ -1,6 +1,6 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
- "Uno.Sdk": "5.3.99"
+ "Uno.Sdk": "6.5.0-dev.5"
}
}
From 1bf0b082abf3c6160bd735619e5cbe4728019c15 Mon Sep 17 00:00:00 2001
From: Martin Zikmund
Date: Fri, 14 Nov 2025 11:00:30 +0100
Subject: [PATCH 4/4] chore: Formatting
---
.../src/WindowingSamples/App.xaml | 33 ++---
.../ExtendContentIntoTitleBarWindow.xaml | 116 +++++++++++-------
2 files changed, 87 insertions(+), 62 deletions(-)
diff --git a/UI/WindowingSamples/src/WindowingSamples/App.xaml b/UI/WindowingSamples/src/WindowingSamples/App.xaml
index 8c8a145a8..9e51e7044 100644
--- a/UI/WindowingSamples/src/WindowingSamples/App.xaml
+++ b/UI/WindowingSamples/src/WindowingSamples/App.xaml
@@ -1,20 +1,21 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
diff --git a/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml b/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml
index 555e13533..024ba7b3f 100644
--- a/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml
+++ b/UI/WindowingSamples/src/WindowingSamples/ExtendContentIntoTitleBarWindow.xaml
@@ -1,4 +1,4 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
- ExtendsContentIntoTitleBar Demo
-
-
- This window demonstrates the ExtendsContentIntoTitleBar API which allows extending XAML UI into the title bar area while preserving the caption buttons (minimize, maximize, close).
-
-
- Notice the custom title bar at the top with the icon, text, and logo - this area is part of the window's content but appears in the title bar region.
-
-
-
-
-
- • Custom UI in title bar area
- • System caption buttons remain visible and functional
- • Supports drag-to-move from title bar
- • Maintains native window behaviors
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ExtendsContentIntoTitleBar Demo
+
+
+ This window demonstrates the ExtendsContentIntoTitleBar API which allows extending XAML UI into the title bar area while preserving the caption buttons (minimize, maximize, close).
+
+ Notice the custom title bar at the top with the icon, text, and logo - this area is part of the window's content but appears in the title bar region.
-
-
-
+
+
+
+ • Custom UI in title bar area
+ • System caption buttons remain visible and functional
+ • Supports drag-to-move from title bar
+ • Maintains native window behaviors
+
+
+
+
+
+