Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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,15 @@ 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();
}

// 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,135 @@
<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 x:Name="AppInfoPanel" Spacing="12">
<!-- note: any top-level StackPanel here is automatically captured for CopyInfo -->

<!-- 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>

<!-- Package Versions -->
<StackPanel Spacing="4">
<TextBlock Text="Package Versions"
FontSize="14"
Opacity="0.7"
Foreground="{ThemeResource OnSurfaceBrush}" />
<TextBox x:Name="PackageVersionsTextBlock"
IsReadOnly="True"
AcceptsReturn="True"
FontSize="16"
Foreground="{ThemeResource OnSurfaceBrush}" />
</StackPanel>

<Button Content="Copy to Clipboard"
Click="CopyInfo"
HorizontalAlignment="Stretch" />
</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 -->
<StackPanel Spacing="16">

<Button Content="Enable visual debugging tool"
Click="EnableDebugPanel"
HorizontalAlignment="Stretch" />

</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
using System.Reflection;
using System.Runtime.InteropServices;
using Uno.Extensions;
using Uno.UI.Extensions;
using Windows.ApplicationModel.DataTransfer;

namespace Uno.Toolkit.Samples.Content
{
public sealed partial class SettingsPage : Page
{
public SettingsPage()
{
this.InitializeComponent();

UpdateAppInfoSafe();
}

private void UpdateAppInfoSafe()
{
// this is called in ctor, dont fail creating the page and the subsequent navigation if anything went wrong
try
{
UpdateAppInfo();
}
catch (Exception) { }
}
private void UpdateAppInfo()
{
// Set version text
VersionTextBlock.Text = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "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

// Set packages information
var assemblyMarkerTypes = new[]
{
typeof(Microsoft.UI.Xaml.Application),
typeof(Uno.Material.MaterialTheme),
// typeof(Uno.Cupertino.CupertinoResources),
typeof(Uno.Toolkit.UI.ToolkitResources),
};
PackageVersionsTextBlock.Text = string.Join("\n", assemblyMarkerTypes
.Select(x =>
{
var name = x.Assembly.GetName();
var version =
(x.Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion?.Trim() is { Length: > 0 } aiv ? aiv : null) ??
name.Version?.ToString() ??
"Unknown";

return $"{name.Name}: {version}";
})
);
}

private void EnableDebugPanel(object sender, RoutedEventArgs e)
{
if (this.FindFirstAncestor<Shell>() is { } shell)
{
shell.EnableDebugPanel();
}
}

private void CopyInfo(object sender, RoutedEventArgs e)
{
var text = string.Join('\n', AppInfoPanel.Children.OfType<StackPanel>()
.Select(x =>
{
var label = (x.Children.ElementAtOrDefault(0) as TextBlock)?.Text ?? "???";
var value = string.Join('\n', x.Children.Skip(1)
.Select(x => x switch
{
TextBlock tblock => tblock.Text,
TextBox tbox => tbox.Text,
_ => null,
})
.Where(x => !string.IsNullOrEmpty(x))
);

return value.Split(['\n', '\r']) is { Length: > 1 } multilines
? string.Join('\n', [$"{label}:", .. multilines.Select(x => " " + x)])
: $"{label}: {value}";
})
);

Clipboard.SetContent(new DataPackage().Apply(x => x.SetText(text)));
Console.WriteLine(text);
}
}
}
16 changes: 8 additions & 8 deletions samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples/Shell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@
Grid.RowSpan="2"
Visibility="Collapsed" />

<local:ModalDialog x:Name="ModalDialog" />
<local:ModalDialog x:Name="ModalDialog" Grid.Row="2" />

<!-- hidden debug tool, revealed from the SettingsPage -->
<StackPanel x:Name="DebugPanel"
x:Load="False"
Grid.RowSpan="2"
Background="Pink"
Padding="5"
Padding="4"
Spacing="4"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
VerticalAlignment="Bottom"
Visibility="Collapsed">
<StackPanel Orientation="Horizontal">
<Button Content="DebugVT"
Click="DebugVT" />
<Button Content="T"
Click="DebugVTAsync" />
<Button Content="DebugVT" Click="DebugVT" />
<Button Content="T" Click="DebugVTAsync" />
</StackPanel>
</StackPanel>
</Grid>
Expand Down
Loading
Loading