mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-20 00:16:35 +08:00
feat: upgrade Avalonia to 12.0.0-preview2.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<AvaloniaVersion>12.0.0-preview1</AvaloniaVersion>
|
||||
<AvaloniaVersion>12.0.0-preview2</AvaloniaVersion>
|
||||
<DataGridVersion>11.3.10</DataGridVersion>
|
||||
<SkiaSharpVersion>3.119.1</SkiaSharpVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<AvaloniaVersion>12.0.0-preview1</AvaloniaVersion>
|
||||
<AvaloniaVersion>12.0.0-preview2</AvaloniaVersion>
|
||||
<DataGridVersion>11.3.7</DataGridVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Utilities;
|
||||
using Irihi.Avalonia.Shared.Helpers;
|
||||
|
||||
namespace Semi.Avalonia.ColorPicker;
|
||||
|
||||
@@ -220,8 +221,8 @@ public class SemiColorDarkPalette: IColorPalette
|
||||
public Color GetColor(int colorIndex, int shadeIndex)
|
||||
{
|
||||
return Colors[
|
||||
MathUtilities.Clamp(colorIndex, 0, ColorCount - 1),
|
||||
MathUtilities.Clamp(shadeIndex, 0, ShadeCount - 1)
|
||||
MathHelpers.SafeClamp(colorIndex, 0, ColorCount - 1),
|
||||
MathHelpers.SafeClamp(shadeIndex, 0, ShadeCount - 1)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Utilities;
|
||||
using Irihi.Avalonia.Shared.Helpers;
|
||||
|
||||
namespace Semi.Avalonia.ColorPicker;
|
||||
|
||||
@@ -220,8 +221,8 @@ public class SemiColorLightPalette: IColorPalette
|
||||
public Color GetColor(int colorIndex, int shadeIndex)
|
||||
{
|
||||
return Colors[
|
||||
MathUtilities.Clamp(colorIndex, 0, ColorCount - 1),
|
||||
MathUtilities.Clamp(shadeIndex, 0, ShadeCount - 1)
|
||||
MathHelpers.SafeClamp(colorIndex, 0, ColorCount - 1),
|
||||
MathHelpers.SafeClamp(shadeIndex, 0, ShadeCount - 1)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<CaptionButtons />
|
||||
</Design.PreviewWith>
|
||||
|
||||
<ControlTheme x:Key="CaptionButton" TargetType="Button">
|
||||
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="CornerRadius" Value="{StaticResource CaptionButtonCornerRadius}" />
|
||||
<Setter Property="Padding" Value="{StaticResource CaptionButtonPadding}" />
|
||||
<Setter Property="Width" Value="{StaticResource CaptionButtonWidth}" />
|
||||
<Setter Property="Height" Value="{StaticResource CaptionButtonHeight}" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="Button">
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonPointeroverBackground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressedBackground}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type CaptionButtons}" TargetType="CaptionButtons">
|
||||
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="CaptionButtons">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="PART_FullScreenButton" Theme="{StaticResource CaptionButton}">
|
||||
<PathIcon
|
||||
Name="PART_FullScreenButtonIcon"
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
Data="{StaticResource WindowExpandGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
<Button
|
||||
Name="PART_MinimizeButton"
|
||||
Theme="{StaticResource CaptionButton}"
|
||||
AutomationProperties.Name="Minimize"
|
||||
Win32Properties.NonClientHitTestResult="MinButton">
|
||||
<PathIcon
|
||||
Name="PART_MinimizeButtonIcon"
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
Data="{StaticResource WindowMinimizeGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
<Button
|
||||
Name="PART_RestoreButton"
|
||||
Theme="{StaticResource CaptionButton}"
|
||||
AutomationProperties.Name="Maximize"
|
||||
Win32Properties.NonClientHitTestResult="MaxButton">
|
||||
<PathIcon
|
||||
Name="PART_RestoreButtonIcon"
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
Data="{StaticResource WindowMaximizeGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
<Button
|
||||
Name="PART_CloseButton"
|
||||
Theme="{StaticResource CaptionButton}"
|
||||
AutomationProperties.Name="Close"
|
||||
Win32Properties.NonClientHitTestResult="Close">
|
||||
<PathIcon
|
||||
Name="PART_CloseButtonIcon"
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
Data="{StaticResource WindowCloseIconGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^ /template/ Button#PART_CloseButton:pointerover">
|
||||
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonCloseForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePointeroverBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Button#PART_CloseButton:pressed">
|
||||
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonCloseForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePressedBackground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:maximized /template/ PathIcon#PART_RestoreButtonIcon">
|
||||
<Setter Property="Data" Value="{StaticResource WindowRestoreGlyph}" />
|
||||
</Style>
|
||||
<Style Selector="^:fullscreen /template/ PathIcon#PART_FullScreenButtonIcon">
|
||||
<Setter Property="Data" Value="{StaticResource WindowCollapseGlyph}" />
|
||||
</Style>
|
||||
<Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
<Style Selector="^:fullscreen /template/ Button#PART_MinimizeButton">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -1,53 +0,0 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ControlTheme x:Key="{x:Type TitleBar}" TargetType="TitleBar">
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Panel HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="Stretch">
|
||||
<Panel
|
||||
Name="PART_MouseTracker"
|
||||
Height="1"
|
||||
VerticalAlignment="Top" />
|
||||
<Panel Name="PART_Container">
|
||||
<Border
|
||||
Name="PART_Background"
|
||||
Background="{TemplateBinding Background}"
|
||||
IsHitTestVisible="False"
|
||||
Win32Properties.NonClientHitTestResult="Caption" />
|
||||
<CaptionButtons
|
||||
Name="PART_CaptionButtons"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Win32Properties.NonClientHitTestResult="Client" />
|
||||
</Panel>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:fullscreen /template/ Border#PART_Background">
|
||||
<Setter Property="IsHitTestVisible" Value="True" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:fullscreen /template/ Panel#PART_MouseTracker">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:fullscreen /template/ Panel#PART_Container">
|
||||
<Setter Property="RenderTransform" Value="translateY(-50px)" />
|
||||
<Setter Property="Transitions">
|
||||
<Transitions>
|
||||
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.1" />
|
||||
</Transitions>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:fullscreen:pointerover /template/ Panel#PART_Container">
|
||||
<Setter Property="RenderTransform" Value="none" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -15,9 +15,6 @@
|
||||
<Border Background="{TemplateBinding Background}" IsHitTestVisible="False" />
|
||||
<Panel Margin="{TemplateBinding WindowDecorationMargin}" Background="Transparent" />
|
||||
<VisualLayerManager>
|
||||
<VisualLayerManager.ChromeOverlayLayer>
|
||||
<TitleBar />
|
||||
</VisualLayerManager.ChromeOverlayLayer>
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
|
||||
67
src/Semi.Avalonia/Controls/WindowDrawnDecorations.axaml
Normal file
67
src/Semi.Avalonia/Controls/WindowDrawnDecorations.axaml
Normal file
@@ -0,0 +1,67 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ControlTheme x:Key="{x:Type WindowDrawnDecorations}" TargetType="WindowDrawnDecorations">
|
||||
<Setter Property="DefaultTitleBarHeight" Value="32" />
|
||||
<Setter Property="DefaultFrameThickness" Value="0,0,0,0" />
|
||||
<Setter Property="DefaultShadowThickness" Value="16" />
|
||||
<Setter Property="Template">
|
||||
<WindowDrawnDecorationsTemplate>
|
||||
<WindowDrawnDecorationsContent>
|
||||
|
||||
<WindowDrawnDecorationsContent.Underlay>
|
||||
<!-- Full-size: covers shadow area + frame + behind client area -->
|
||||
<Panel>
|
||||
<Border Margin="{TemplateBinding ShadowThickness}"
|
||||
Background="{DynamicResource WindowBackground}"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource WindowBorderBrush}"
|
||||
BoxShadow="0 8 32 0 #40000000" />
|
||||
</Panel>
|
||||
</WindowDrawnDecorationsContent.Underlay>
|
||||
|
||||
<WindowDrawnDecorationsContent.Overlay>
|
||||
<!-- Positioned over the titlebar area -->
|
||||
<DockPanel Height="{TemplateBinding TitleBarHeight}"
|
||||
VerticalAlignment="Top"
|
||||
Margin="{TemplateBinding ShadowThickness}">
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
||||
<Button x:Name="PART_MinimizeButton" Content="─" />
|
||||
<Button x:Name="PART_MaximizeButton" Content="□" />
|
||||
<Button x:Name="PART_CloseButton" Content="✕" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{TemplateBinding Title}"
|
||||
VerticalAlignment="Center"
|
||||
Margin="12,0"
|
||||
WindowDecorationProperties.ElementRole="TitleBar" />
|
||||
</DockPanel>
|
||||
</WindowDrawnDecorationsContent.Overlay>
|
||||
|
||||
<WindowDrawnDecorationsContent.FullscreenPopover>
|
||||
<!-- Shown on hover at top edge in fullscreen -->
|
||||
<DockPanel Height="{TemplateBinding TitleBarHeight}"
|
||||
Background="#E0000000">
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
||||
<Button x:Name="PART_MinimizeButton" Content="─" />
|
||||
<Button x:Name="PART_MaximizeButton" Content="□" />
|
||||
<Button x:Name="PART_CloseButton" Content="✕" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{TemplateBinding Title}"
|
||||
Foreground="White"
|
||||
VerticalAlignment="Center"
|
||||
Margin="12,0" />
|
||||
</DockPanel>
|
||||
</WindowDrawnDecorationsContent.FullscreenPopover>
|
||||
|
||||
</WindowDrawnDecorationsContent>
|
||||
</WindowDrawnDecorationsTemplate>
|
||||
</Setter>
|
||||
|
||||
<!-- Pseudoclass styling -->
|
||||
<Style Selector="^:maximized /template/ Border">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Style>
|
||||
<Style Selector="^:fullscreen /template/ DockPanel">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -9,7 +9,6 @@
|
||||
<ResourceInclude Source="ButtonSpinner.axaml" />
|
||||
<ResourceInclude Source="Calendar.axaml" />
|
||||
<ResourceInclude Source="CalendarDatePicker.axaml" />
|
||||
<ResourceInclude Source="CaptionButtons.axaml" />
|
||||
<ResourceInclude Source="Carousel.axaml" />
|
||||
<ResourceInclude Source="CheckBox.axaml" />
|
||||
<ResourceInclude Source="ComboBox.axaml" />
|
||||
@@ -51,13 +50,13 @@
|
||||
<ResourceInclude Source="TextBox.axaml" />
|
||||
<ResourceInclude Source="ThemeVariantScope.axaml" />
|
||||
<ResourceInclude Source="TimePicker.axaml" />
|
||||
<ResourceInclude Source="TitleBar.axaml" />
|
||||
<ResourceInclude Source="ToggleButton.axaml" />
|
||||
<ResourceInclude Source="ToggleSwitch.axaml" />
|
||||
<ResourceInclude Source="Tooltip.axaml" />
|
||||
<ResourceInclude Source="TransitioningContentControl.axaml" />
|
||||
<ResourceInclude Source="TreeView.axaml" />
|
||||
<ResourceInclude Source="Window.axaml" />
|
||||
<ResourceInclude Source="WindowDrawnDecorations.axaml" />
|
||||
<ResourceInclude Source="WindowNotificationManager.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user