Skip to content
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion build/workflow/copilot/restore-solution.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail

# Create a desktop-only crosstargeting override for build pipelines
cat > "src/crosstargeting_override.props" << 'EOF'
Copy link
Copy Markdown
Contributor

@agneszitte agneszitte Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file writes src/crosstargeting_override.props and the samples csproj auto-imports it if present. That can affect local builds after the script runs. Maybe consider scoping/cleanup or env-gated import no ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround until the devserver fixes a few things, it probably won't get merged as-is.

<Project ToolsVersion="15.0">
<PropertyGroup>
<DisableMobileTargets>true</DisableMobileTargets>
<SamplesTargetFrameworkOverride>net10.0-desktop</SamplesTargetFrameworkOverride>
<TargetFrameworkOverride>net9.0</TargetFrameworkOverride>
</PropertyGroup>
</Project>
EOF

cd src

dotnet workload restore
dotnet workload install android

# Restore solution packages to ensure dependencies are ready for subsequent steps
dotnet restore src/Uno.Toolkit.sln -p:SamplesTargetFrameworkOverride=net9.0-desktop -p:DisableMobileTargets=true
dotnet restore Uno.Toolkit.sln

# Preload the dev server tool
dotnet dnx -y uno.devserver --prerelease -- start -l trace

sleep 20

dotnet dnx -y uno.devserver --prerelease -- stop -l trace

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Reflection;
using Uno.Extensions;

using MUXC = Microsoft.UI.Xaml.Controls;
Expand All @@ -10,6 +9,7 @@ partial class App
{
private static Sample[] _samples;
private static IDictionary<string, Type> _nestedSampleMap;
private Content.SettingsPage _settingsPage;

/// <summary>
/// Invoked when Navigation to a certain page fails
Expand Down Expand Up @@ -124,7 +124,16 @@ private void OnNavigationItemInvoked(MUXC.NavigationView sender, MUXC.Navigation
}
else if (e.IsSettingsInvoked)
{
_shell.ActivateDebugPanel();
// Cache the settings page to avoid recreating it each time
if (_settingsPage == null)
{
_settingsPage = new Content.SettingsPage();
_settingsPage.SetShell(_shell);
}

// Clear selected item to avoid having a sample highlighted while Settings is displayed
_shell.NavigationView.SelectedItem = null;
_shell.NavigationView.Content = _settingsPage;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Page x:Class="Uno.Toolkit.Samples.Content.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Uno.Toolkit.Samples.Content"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>
<ScrollViewer>
<StackPanel Padding="48,24" Spacing="24" MaxWidth="600">
<!-- Header -->
<TextBlock Text="Settings"
FontSize="32"
FontWeight="Bold"
Foreground="{ThemeResource OnBackgroundBrush}" />

<!-- App Information Section -->
<StackPanel Spacing="16">
<TextBlock Text="About"
FontSize="20"
FontWeight="SemiBold"
Foreground="{ThemeResource OnBackgroundBrush}" />

<Border Background="{ThemeResource SurfaceBrush}"
CornerRadius="8"
Padding="16">
<StackPanel Spacing="12">
<!-- App Name -->
<StackPanel Spacing="4">
<TextBlock Text="Application"
FontSize="14"
Opacity="0.7"
Foreground="{ThemeResource OnSurfaceBrush}" />
<TextBlock Text="Uno Toolkit Samples"
FontSize="16"
FontWeight="SemiBold"
Foreground="{ThemeResource OnSurfaceBrush}" />
</StackPanel>

<!-- Version -->
<StackPanel Spacing="4">
<TextBlock Text="Version"
FontSize="14"
Opacity="0.7"
Foreground="{ThemeResource OnSurfaceBrush}" />
<TextBlock x:Name="VersionTextBlock"
FontSize="16"
FontWeight="SemiBold"
Foreground="{ThemeResource OnSurfaceBrush}" />
</StackPanel>

<!-- Framework -->
<StackPanel Spacing="4">
<TextBlock Text="Framework"
FontSize="14"
Opacity="0.7"
Foreground="{ThemeResource OnSurfaceBrush}" />
<TextBlock x:Name="FrameworkTextBlock"
FontSize="16"
FontWeight="SemiBold"
Foreground="{ThemeResource OnSurfaceBrush}" />
</StackPanel>

<!-- Platform -->
<StackPanel Spacing="4">
<TextBlock Text="Platform"
FontSize="14"
Opacity="0.7"
Foreground="{ThemeResource OnSurfaceBrush}" />
<TextBlock x:Name="PlatformTextBlock"
FontSize="16"
FontWeight="SemiBold"
Foreground="{ThemeResource OnSurfaceBrush}" />
</StackPanel>
</StackPanel>
</Border>
</StackPanel>

<!-- Additional Information -->
<StackPanel Spacing="16">
<TextBlock Text="Learn More"
FontSize="20"
FontWeight="SemiBold"
Foreground="{ThemeResource OnBackgroundBrush}" />

<Border Background="{ThemeResource SurfaceBrush}"
CornerRadius="8"
Padding="16">
<StackPanel Spacing="12">
<HyperlinkButton Content="Uno Toolkit Documentation"
NavigateUri="https://platform.uno/docs/articles/external/uno.toolkit.ui/doc/getting-started.html"
Padding="0" />
<HyperlinkButton Content="GitHub Repository"
NavigateUri="https://github.com/unoplatform/uno.toolkit.ui"
Padding="0" />
<HyperlinkButton Content="Report an Issue"
NavigateUri="https://github.com/unoplatform/uno.toolkit.ui/issues"
Padding="0" />
</StackPanel>
</Border>
</StackPanel>

<!-- Debug Tools Section (DEBUG only) -->
<StackPanel x:Name="DebugToolsSection" Spacing="16" x:Load="False">
<TextBlock Text="Debug Tools"
FontSize="20"
FontWeight="SemiBold"
Foreground="{ThemeResource OnBackgroundBrush}" />

<Border Background="{ThemeResource SurfaceBrush}"
CornerRadius="8"
Padding="16">
<StackPanel Spacing="12">
<TextBlock Text="Development and debugging utilities"
FontSize="14"
Opacity="0.7"
Foreground="{ThemeResource OnSurfaceBrush}"
TextWrapping="Wrap" />
<Button x:Name="CopyVisualTreeButton"
Content="Copy Visual Tree"
Click="OnCopyVisualTreeClick"
HorizontalAlignment="Stretch" />
<Button x:Name="TestVisualStateButton"
Content="Test Visual State"
Click="OnTestVisualStateClick"
HorizontalAlignment="Stretch" />
</StackPanel>
</Border>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System.Reflection;
using System.Runtime.InteropServices;

namespace Uno.Toolkit.Samples.Content
{
public sealed partial class SettingsPage : Page
{
private Shell _shell;

public SettingsPage()
{
this.InitializeComponent();

// Initialize version information once since the page is cached
var assembly = Assembly.GetExecutingAssembly();
var assemblyName = assembly.GetName();
var version = assemblyName.Version;

// Set version text
VersionTextBlock.Text = version != null ? $"{version.Major}.{version.Minor}.{version.Build}" : "Unknown";

// Set framework information
FrameworkTextBlock.Text = RuntimeInformation.FrameworkDescription;

// Set platform information
#if __ANDROID__
PlatformTextBlock.Text = "Android";
#elif __IOS__
PlatformTextBlock.Text = "iOS";
#elif __WASM__
PlatformTextBlock.Text = "WebAssembly";
#elif __MACOS__
PlatformTextBlock.Text = "macOS";
#elif WINDOWS_UWP
PlatformTextBlock.Text = "UWP";
#elif WINDOWS || WINDOWS_WINUI
PlatformTextBlock.Text = "Windows (WinUI)";
#else
// For Skia desktop builds, detect at runtime
// Check if we're running on a desktop platform (Windows, Linux, macOS) but not in browser
var isDesktop = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
RuntimeInformation.IsOSPlatform(OSPlatform.OSX);

if (isDesktop)
{
PlatformTextBlock.Text = "Skia (Desktop)";
}
else
{
PlatformTextBlock.Text = "Unknown";
}
#endif

#if DEBUG
// Load debug tools section in DEBUG builds only
this.FindName(nameof(DebugToolsSection));
#endif
}

public void SetShell(Shell shell)
{
_shell = shell;
}

private void OnCopyVisualTreeClick(object sender, RoutedEventArgs e)
{
#if DEBUG
_shell?.DebugCopyVisualTree();
#endif
}

private void OnTestVisualStateClick(object sender, RoutedEventArgs e)
{
#if DEBUG
_shell?.DebugTestVisualState();
#endif
}
}
}
11 changes: 11 additions & 0 deletions samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples/Shell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ internal void ActivateDebugPanel()
this.FindName("DebugPanel"); // materialize x:Load=false element
}

// Public methods for SettingsPage to call debug functionality
public void DebugCopyVisualTree()
{
DebugVT(this, null);
}

public void DebugTestVisualState()
{
DebugVTAsync(this, null);
}

private void ToggleButton_Click(object sender, RoutedEventArgs e)
{
if (this.XamlRoot.Content is FrameworkElement root)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<Project Sdk="Uno.Sdk.Private">
<Import Project="..\..\..\src\crosstargeting_override.props" Condition="Exists('..\..\..\src\crosstargeting_override.props')" />

<PropertyGroup>
<TargetFrameworks Condition="'$(SamplesTargetFrameworkOverride)'!=''">$(SamplesTargetFrameworkOverride)</TargetFrameworks>
<TargetFrameworks Condition="'$(SamplesTargetFrameworkOverride)'==''">net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-windows10.0.26100;net10.0-browserwasm;net10.0-desktop</TargetFrameworks>
Expand Down
Loading