Compare commits

...

12 Commits

Author SHA1 Message Date
Zhang Dian
16e646ddde misc: follow .editorconfig from Avalonia. 2026-04-09 16:03:27 +08:00
Zhang Dian
4447475f18 chore: bump ColorPicker & DataGrid version to 12.0.0. 2026-04-08 01:00:05 +08:00
Zhang Dian
e53e744d1f Refactor ColorPicker components and improve UI consistency (#795)
* feat: add converters and update bindings in ColorPicker components.

* feat: simplify ColorPicker layout by replacing complex structure with ColorView component.

* feat: remove CornerRadiusToDoubleConverter.

* feat: replace EnumToBoolConverter & ToColorModel with ObjectConverters.Equal.

* feat: set HexInputAlphaPosition to Trailing.

* feat: update ColorView layout and styling for improved UI consistency.

* feat: bind Increment property of ColorSliders to respective TickFrequency and Slider values.

* feat: update ColorView bindings to use new syntax and adjust CornerRadius for improved styling.

* feat: update ColorPicker SelectedIndex Mode to TwoWay.

* feat: sync upstream changes.

* feat: update ColorPicker and ColorView to use SemiColorPalette for improved color selection.

* feat: update ControlTemplate TargetType.

* feat: add AIPurple colors to Palette.

* refactor: display real Hex in HexColorPicker.

* fix: update ColorView bindings to handle null values with a converter.

* refactor: refactor ColorPicker demo.

* refactor: replace RelativeSource bindings with TemplateBinding in ColorView.

* chore: copy ColorView Template to ColorPicker.

* fix: update AlphaEnabled ToggleSwitch content to reflect correct label.

* fix: fix index order in ColorPicker.
2026-04-08 00:55:03 +08:00
Zhang Dian
6eaa47e7ce chore: bump version to 12.0.0. 2026-04-08 00:09:46 +08:00
Zhang Dian
1edc65c091 Remove obsolete resources. (#792) 2026-04-08 00:03:22 +08:00
Dong Bin
1348149957 Update Drawer to match upstream design (#790)
* feat: update DrawerPage and related resources for improved layout and functionality

* feat: enable mouse swipe gesture for Drawer control.

* chore: remove useless resources.

* chore: remove useless Style.

* chore: using TemplateBinding.

* fix: using InnerPathIcon theme for Icon.

* fix: use normal Binding.

---------

Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
2026-04-07 23:56:17 +08:00
Zhang Dian
3b4443cd54 Fix CarouselPage ControlTemplate and sync NavigationPage template (#791)
* fix: specify TargetType in ControlTemplate for CarouselPage and remove redundant ItemsSource bindings in TabbedPage.

* feat: sync ContentPage with Avalonia Fluent version.

* fix: sync upstream NavigationPage template.

* feat: adjust NavigationPage bar height and add large style support

* feat: add ToggleSwitch for large style support in NavigationPageDemo

---------

Co-authored-by: Dong Bin <popmessiah@hotmail.com>
2026-04-07 23:53:11 +08:00
Zhang Dian
35bea6ff1f feat: add maximize2 and restore icons. 2026-04-07 21:30:36 +08:00
Zhang Dian
c393d41112 chore: upgrade version to Avalonia 12.0.0. 2026-04-07 21:29:32 +08:00
Zhang Dian
d4c4ef1dba Merge branch '12.0.0-rc2' 2026-04-07 21:14:20 +08:00
Copilot
77dffc55b1 Sync 45 new icons from Semi Design commit ba384587 (#761)
* Initial plan

* Sync 45 new icons from Semi Design commit ba384587

Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com>

* fix: correct geometry paths for Semi icons.

* fix: update EyeClosedSolidStroked & IconHornStroked paths for Semi icons in StrokedIcons.axaml.

* fix: resolve copilot review.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com>
2026-03-10 14:42:21 +08:00
Gehongyan
3ba357b691 Fix TextBox MaxLines property not constraining height in Semi theme (#753)
* Initial plan

* Fix TextBox MaxLines property by adding Name=PART_ScrollViewer to ScrollViewer elements

Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-03-05 23:16:29 +08:00
53 changed files with 1130 additions and 1042 deletions

243
.editorconfig Normal file
View File

@@ -0,0 +1,243 @@
# editorconfig.org
# top-most EditorConfig file
root = true
# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = true
indent_style = space
indent_size = 4
# C# files
[*.cs]
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# trim_trailing_whitespace = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current
# avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# prefer var
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true:suggestion
# use language keywords instead of BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# private static fields should have s_ prefix
dotnet_naming_rule.private_static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.private_static_fields_should_have_prefix.symbols = private_static_fields
dotnet_naming_rule.private_static_fields_should_have_prefix.style = private_static_prefix_style
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_fields.required_modifiers = static
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private
dotnet_naming_style.private_static_prefix_style.required_prefix = s_
dotnet_naming_style.private_static_prefix_style.capitalization = camel_case
# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
# use accessibility modifiers
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# Code style defaults
dotnet_sort_system_directives_first = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
# Expression-bodied members
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
# Null checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
space_within_single_line_array_initializer_braces = true
#Net Analyzer
dotnet_analyzer_diagnostic.category-Performance.severity = none #error - Uncomment when all violations are fixed.
# CA1018: Mark attributes with AttributeUsageAttribute
dotnet_diagnostic.CA1018.severity = warning
# CA1304: Specify CultureInfo
dotnet_diagnostic.CA1304.severity = warning
# CA1802: Use literals where appropriate
dotnet_diagnostic.CA1802.severity = warning
# CA1813: Avoid unsealed attributes
dotnet_diagnostic.CA1813.severity = warning
# CA1815: Override equals and operator equals on value types
dotnet_diagnostic.CA1815.severity = warning
# CA1820: Test for empty strings using string length
dotnet_diagnostic.CA1820.severity = warning
# CA1821: Remove empty finalizers
dotnet_diagnostic.CA1821.severity = warning
# CA1822: Mark members as static
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_code_quality.CA1822.api_surface = private, internal
# CA1823: Avoid unused private fields
dotnet_diagnostic.CA1823.severity = warning
# CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1825.severity = warning
# CA1826: Use property instead of Linq Enumerable method
dotnet_diagnostic.CA1826.severity = suggestion
# CA1827: Do not use Count/LongCount when Any can be used
dotnet_diagnostic.CA1827.severity = warning
# CA1828: Do not use CountAsync/LongCountAsync when AnyAsync can be used
dotnet_diagnostic.CA1828.severity = warning
# CA1829: Use Length/Count property instead of Enumerable.Count method
dotnet_diagnostic.CA1829.severity = warning
#CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.CA1847.severity = warning
# CA1851: Possible multiple enumerations of IEnumerable collection
dotnet_diagnostic.CA1851.severity = warning
#CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method
dotnet_diagnostic.CA1854.severity = warning
#CA2211:Non-constant fields should not be visible
dotnet_diagnostic.CA2211.severity = warning
# Wrapping preferences
csharp_wrap_before_ternary_opsigns = false
# Avalonia DevAnalyzer preferences
dotnet_diagnostic.AVADEV2001.severity = warning
# Avalonia PublicAnalyzer preferences
dotnet_diagnostic.AVP1000.severity = warning
dotnet_diagnostic.AVP1001.severity = warning
dotnet_diagnostic.AVP1002.severity = warning
dotnet_diagnostic.AVP1010.severity = warning
dotnet_diagnostic.AVP1011.severity = warning
dotnet_diagnostic.AVP1012.severity = warning
dotnet_diagnostic.AVP1013.severity = warning
dotnet_diagnostic.AVP1020.severity = warning
dotnet_diagnostic.AVP1021.severity = warning
dotnet_diagnostic.AVP1022.severity = warning
dotnet_diagnostic.AVP1030.severity = warning
dotnet_diagnostic.AVP1031.severity = warning
dotnet_diagnostic.AVP1032.severity = warning
dotnet_diagnostic.AVP1040.severity = warning
dotnet_diagnostic.AVA2001.severity = warning
# Xaml files
[*.{xaml,axaml}]
indent_size = 2
# DuplicateSetterError
avalonia_xaml_diagnostic.AVLN2203.severity = warning
# StyleInMergedDictionaries
avalonia_xaml_diagnostic.AVLN2204.severity = warning
# RequiredTemplatePartMissing
avalonia_xaml_diagnostic.AVLN2205.severity = warning
# OptionalTemplatePartMissing
avalonia_xaml_diagnostic.AVLN2206.severity = info
# TemplatePartWrongType
avalonia_xaml_diagnostic.AVLN2207.severity = warning
# ItemContainerInsideTemplate
avalonia_xaml_diagnostic.AVLN2208.severity = warning
# Obsolete
avalonia_xaml_diagnostic.AVLN5001.severity = warning
# Xml project files
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2
# Xml build files
[*.builds]
indent_size = 2
# Xml files
[*.{xml,stylecop,resx,ruleset}]
indent_size = 2
# Xml config files
[*.{props,targets,config,nuspec}]
indent_size = 2
[*.json]
indent_size = 2
# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd,bat}]
end_of_line = crlf

View File

@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.0-rc2</AvaloniaVersion>
<DataGridVersion>12.0.0-rc2</DataGridVersion>
<AvaloniaVersion>12.0.0</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
<SkiaSharpVersion>3.119.3-preview.1.1</SkiaSharpVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -2,80 +2,90 @@
x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="1450"
d:DesignWidth="800"
mc:Ignorable="d">
<ScrollViewer>
<StackPanel Spacing="20">
<StackPanel Orientation="Horizontal" Spacing="20">
<ColorView Name="Test" ColorSpectrumShape="Ring" />
<ColorView ColorSpectrumShape="Box" />
<ColorView Palette="{DynamicResource SemiColorPalette}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ColorView
Name="SimpleColorViewTest"
HsvColor="hsv(180,80%,70%)"
IsAlphaVisible="True"
Theme="{StaticResource SimpleColorView}" />
<StackPanel>
<TextBlock Text="{Binding #SimpleColorViewTest.HsvColor}" />
<TextBlock Text="{Binding #SimpleColorViewTest.Color}" />
<DockPanel>
<ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8">
<StackPanel.Styles>
<Style Selector="ToggleSwitch">
<Setter Property="OffContent" Value="{Binding $self.OnContent}" />
</Style>
</StackPanel.Styles>
<StackPanel Spacing="8">
<ToggleSwitch Name="AccentColors" OnContent="IsAccentColorsVisible" IsChecked="True" />
<ToggleSwitch Name="AlphaEnabled" OnContent="IsAlphaEnabled" IsChecked="True" />
<ToggleSwitch Name="Alpha" OnContent="IsAlphaVisible" IsChecked="True" />
<ToggleSwitch Name="ColorComponents" OnContent="IsColorComponentsVisible" IsChecked="True" />
<ToggleSwitch Name="ColorModel" OnContent="IsColorModelVisible" IsChecked="True" />
<ToggleSwitch Name="ColorPalette" OnContent="IsColorPaletteVisible" IsChecked="True" />
<ToggleSwitch Name="ColorPreview" OnContent="IsColorPreviewVisible" IsChecked="True" />
<ToggleSwitch Name="ColorSpectrum" OnContent="IsColorSpectrumVisible" IsChecked="True" />
<ToggleSwitch Name="ColorSpectrumSlider" OnContent="IsColorSpectrumSliderVisible" IsChecked="True" />
<ToggleSwitch Name="ComponentSlider" OnContent="IsComponentSliderVisible" IsChecked="True" />
<ToggleSwitch Name="ComponentTextInput" OnContent="IsComponentTextInputVisible" IsChecked="True" />
<ToggleSwitch Name="HexInput" OnContent="IsHexInputVisible" IsChecked="True" />
</StackPanel>
<Separator />
<StackPanel Spacing="8">
<TextBlock>
<Run Text="Color: " />
<Run Text="{Binding #cv.Color,Mode=OneWay}" />
</TextBlock>
<TextBlock>
<Run Text="HsvColor:" />
<Run Text="{Binding #cv.HsvColor,Mode=OneWay}" />
</TextBlock>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<ColorPicker ColorSpectrumShape="Ring">
<ColorPicker.Palette>
<FlatHalfColorPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker ColorSpectrumShape="Box">
<ColorPicker.Palette>
<semi:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker
Theme="{DynamicResource HexColorPicker}"
ColorSpectrumShape="Box">
<ColorPicker.Palette>
<semi:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
</StackPanel>
<StackPanel HorizontalAlignment="Left">
<TextBlock Text="Use Style to customize button" />
<ColorPicker
Margin="8"
MinWidth="32"
HsvColor="hsv(180,80%,70%)">
<ColorPicker.Content>
<Border
Margin="1"
Background="{Binding $parent[ColorPicker].HsvColor, Converter={StaticResource ToBrushConverter}}"
CornerRadius="1" />
</ColorPicker.Content>
<ColorPicker.Styles>
<Style Selector="DropDownButton">
<Setter Property="Padding" Value="0" />
<Style Selector="^ /template/ PathIcon">
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
</ColorPicker.Styles>
</ColorPicker>
</StackPanel>
</ScrollViewer>
<StackPanel Orientation="Horizontal" Spacing="8">
<ColorPicker
Theme="{StaticResource SimpleColorPicker}"
HsvColor="hsv(180,80%,70%)" />
<ColorPicker
Theme="{StaticResource HexSimpleColorPicker}"
HsvColor="hsv(180,80%,70%)" />
<Border Margin="12"
BorderBrush="{DynamicResource SemiColorBorder}"
BorderThickness="1"
CornerRadius="6"
ClipToBounds="True">
<Border.Styles>
<Style Selector=":is(ColorView)">
<Setter Property="IsAccentColorsVisible" Value="{Binding #AccentColors.IsChecked}" />
<Setter Property="IsAlphaEnabled" Value="{Binding #AlphaEnabled.IsChecked}" />
<Setter Property="IsAlphaVisible" Value="{Binding #Alpha.IsChecked}" />
<Setter Property="IsColorComponentsVisible" Value="{Binding #ColorComponents.IsChecked}" />
<Setter Property="IsColorModelVisible" Value="{Binding #ColorModel.IsChecked}" />
<Setter Property="IsColorPaletteVisible" Value="{Binding #ColorPalette.IsChecked}" />
<Setter Property="IsColorPreviewVisible" Value="{Binding #ColorPreview.IsChecked}" />
<Setter Property="IsColorSpectrumVisible" Value="{Binding #ColorSpectrum.IsChecked}" />
<Setter Property="IsColorSpectrumSliderVisible" Value="{Binding #ColorSpectrumSlider.IsChecked}" />
<Setter Property="IsComponentSliderVisible" Value="{Binding #ComponentSlider.IsChecked}" />
<Setter Property="IsComponentTextInputVisible" Value="{Binding #ComponentTextInput.IsChecked}" />
<Setter Property="IsHexInputVisible" Value="{Binding #HexInput.IsChecked}" />
<Setter Property="Color" Value="#39C5BB" />
</Style>
</Border.Styles>
<StackPanel Margin="12" Spacing="12" Orientation="Horizontal">
<StackPanel Spacing="12">
<TextBlock Text="Default Theme" FontWeight="Bold" FontSize="16" />
<ColorView Name="cv" />
<StackPanel Spacing="12" Orientation="Horizontal">
<ColorPicker />
<ColorPicker Theme="{DynamicResource HexColorPicker}" />
</StackPanel>
</StackPanel>
<StackPanel Spacing="12">
<TextBlock Text="SimpleColorPicker" FontWeight="Bold" FontSize="16" />
<ColorView Theme="{DynamicResource SimpleColorView}" />
<StackPanel Spacing="12" Orientation="Horizontal">
<ColorPicker Theme="{DynamicResource SimpleColorPicker}" />
<ColorPicker Theme="{DynamicResource HexSimpleColorPicker}" />
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Border>
</DockPanel>
</UserControl>

View File

@@ -23,6 +23,13 @@
Content="Gesture Enabled"
IsChecked="True"
IsCheckedChanged="OnGestureChanged" />
<ComboBox SelectionChanged="OnLayoutChanged" >
<ComboBoxItem Content="CompactOverlay" />
<ComboBoxItem Content="CompactInline" />
<ComboBoxItem Content="Split" />
<ComboBoxItem Content="Overlay" />
</ComboBox>
<Separator />
@@ -35,38 +42,36 @@
</ScrollViewer>
<Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SemiColorBackground0}" />
<Border Margin="12"
BorderBrush="{DynamicResource SemiColorBorder}"
BorderThickness="1"
CornerRadius="6"
ClipToBounds="True">
<DrawerPage Name="DemoDrawer"
Header="First Look"
DrawerLength="250">
<DrawerPage.DrawerHeader>
<Border Padding="16" Background="{DynamicResource SemiColorPrimary}">
<TextBlock Text="Menu" FontSize="18" FontWeight="SemiBold" Foreground="{DynamicResource SemiColorText0}" />
</Border>
</DrawerPage.DrawerHeader>
<DrawerPage.Drawer>
<ListBox Name="DrawerMenu" SelectionChanged="OnMenuSelectionChanged">
<ListBoxItem Content="Home" />
<ListBoxItem Content="Settings" />
<ListBoxItem Content="Profile" />
<ListBoxItem Content="About" />
</ListBox>
</DrawerPage.Drawer>
<DrawerPage.Content>
<ContentPage Header="Home">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="8">
<TextBlock Text="Home Page" FontSize="20" FontWeight="SemiBold" HorizontalAlignment="Center" />
<TextBlock Text="Swipe from the left edge or use the hamburger button to open the drawer."
FontSize="13" Opacity="0.7" TextWrapping="Wrap" TextAlignment="Center" MaxWidth="300" />
</StackPanel>
</ContentPage>
</DrawerPage.Content>
</DrawerPage>
</Border>
<DrawerPage Name="DemoDrawer"
Margin="12"
Header="First Look"
DrawerLayoutBehavior="Overlay"
CompactDrawerLength="80"
DrawerLength="250">
<DrawerPage.DrawerHeader>
<TextBlock Text="Menu" Margin="16" FontSize="18" FontWeight="SemiBold" Foreground="{DynamicResource SemiColorPrimary}" />
</DrawerPage.DrawerHeader>
<DrawerPage.DrawerFooter>
<TextBlock HorizontalAlignment="Center" Text="Powered by IRIHI" Margin="8" />
</DrawerPage.DrawerFooter>
<DrawerPage.Drawer>
<ListBox Name="DrawerMenu" SelectionChanged="OnMenuSelectionChanged">
<ListBoxItem Content="Home" />
<ListBoxItem Content="Settings" />
<ListBoxItem Content="Profile" />
<ListBoxItem Content="About" />
</ListBox>
</DrawerPage.Drawer>
<DrawerPage.Content>
<ContentPage Header="Home">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="8">
<TextBlock Text="Home Page" FontSize="20" FontWeight="SemiBold" HorizontalAlignment="Center" />
<TextBlock Text="Swipe from the left edge or use the hamburger button to open the drawer."
FontSize="13" Opacity="0.7" TextWrapping="Wrap" TextAlignment="Center" MaxWidth="300" />
</StackPanel>
</ContentPage>
</DrawerPage.Content>
</DrawerPage>
</DockPanel>
</UserControl>

View File

@@ -1,8 +1,9 @@
using System;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Input.GestureRecognizers;
using Avalonia.Interactivity;
using Avalonia.Layout;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Pages;
@@ -11,6 +12,7 @@ public partial class DrawerPageDemo : UserControl
public DrawerPageDemo()
{
InitializeComponent();
EnableMouseSwipeGesture(DemoDrawer);
}
protected override void OnLoaded(RoutedEventArgs e)
@@ -52,7 +54,6 @@ public partial class DrawerPageDemo : UserControl
FontSize = 16,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Foreground = Brushes.Black,
},
HorizontalContentAlignment = HorizontalAlignment.Stretch,
VerticalContentAlignment = VerticalAlignment.Stretch
@@ -65,4 +66,25 @@ public partial class DrawerPageDemo : UserControl
{
StatusText.Text = $"Drawer: {(DemoDrawer.IsOpen ? "Open" : "Closed")}";
}
private static void EnableMouseSwipeGesture(Control control)
{
var recognizer = control.GestureRecognizers
.OfType<SwipeGestureRecognizer>()
.FirstOrDefault();
recognizer?.IsMouseEnabled = true;
}
private void OnLayoutChanged(object? sender, SelectionChangedEventArgs e)
{
DemoDrawer.DrawerLayoutBehavior = (sender as ComboBox)?.SelectedIndex switch
{
0 => DrawerLayoutBehavior.CompactOverlay,
1 => DrawerLayoutBehavior.CompactInline,
2 => DrawerLayoutBehavior.Split,
3 => DrawerLayoutBehavior.Overlay,
_ => DrawerLayoutBehavior.CompactOverlay
};
}
}

View File

@@ -48,6 +48,7 @@
Text="Current: Home"
Opacity="0.7"
TextWrapping="Wrap" />
<ToggleSwitch Content="Large" Name="large" />
</StackPanel>
</ScrollViewer>
@@ -58,7 +59,9 @@
BorderThickness="1"
CornerRadius="6"
ClipToBounds="True">
<NavigationPage Name="DemoNav" />
<NavigationPage
Name="DemoNav"
Classes.Large="{Binding #large.IsChecked}" />
</Border>
</DockPanel>
</ScrollViewer>

View File

@@ -1,14 +1,14 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.0-rc2</AvaloniaVersion>
<DataGridVersion>12.0.0-rc2</DataGridVersion>
<AvaloniaVersion>12.0.0</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.4.0-rc1"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.4.0"/>
</ItemGroup>
</Project>

View File

@@ -2,38 +2,48 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:ToBrushConverter x:Key="ToBrushConverter" />
xmlns:semi="https://irihi.tech/semi">
<Design.PreviewWith>
<StackPanel Width="500" Height="500">
<ColorPicker Name="cp" Color="#AAAAAAAA" IsAlphaVisible="True" IsAlphaEnabled="True" />
<ColorPicker Theme="{DynamicResource SimpleColorPicker}" Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
<ColorPicker Theme="{DynamicResource HexSimpleColorPicker}" Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
<ColorView Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
<Setter Property="MinWidth" Value="64" />
<!-- Alpha position should match CSS (and default slider order) instead of XAML/WinUI -->
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Padding" Value="0 0 10 0" />
<Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" />
<Setter Property="Palette" Value="{DynamicResource SemiColorPalette}" />
<Setter Property="Content">
<Template>
<Panel>
<Border
Margin="1,1,0,1"
Width="{Binding $self.Bounds.Height}"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
<Border
Margin="1,1,0,1"
Width="{Binding $self.Bounds.Height}"
Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
</Panel>
</Template>
</Setter>
<Setter Property="Palette">
<FluentColorPalette />
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorPicker}">
<ControlTemplate TargetType="ColorPicker">
<DropDownButton
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
@@ -49,7 +59,9 @@
</Style>
</DropDownButton.Styles>
<DropDownButton.Flyout>
<Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource ColorPickerFlyoutPlacement}">
<Flyout
FlyoutPresenterClasses="nopadding"
Placement="{DynamicResource ColorPickerFlyoutPlacement}">
<!--
The following is copy-pasted from the ColorView's control template.
@@ -57,7 +69,6 @@
Note the only changes are resources specific to the ColorPicker.
-->
<Grid
Name="RootGrid"
Width="300"
Height="300"
RowDefinitions="*,Auto">
@@ -81,7 +92,7 @@
Padding="0"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
<TabControl.Styles>
<Style Selector="TabItem">
<Setter Property="MinHeight" Value="32" />
@@ -116,11 +127,11 @@
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
AutomationProperties.Name="Third Component"
ColorComponent="{Binding ThirdComponent, ElementName=ColorSpectrum}"
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}"
ColorModel="Hsva"
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsAlphaVisible="True"
IsPerceptive="False"
HsvColor="{Binding #ColorSpectrum.HsvColor}"
IsAlphaVisible="False"
IsPerceptive="True"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Vertical" />
<ColorSpectrum
@@ -129,7 +140,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
MaxSaturation="{TemplateBinding MaxSaturation}"
MaxValue="{TemplateBinding MaxValue}"
@@ -146,14 +157,10 @@
AutomationProperties.Name="Alpha Component"
ColorComponent="Alpha"
ColorModel="Hsva"
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
HsvColor="{Binding #ColorSpectrum.HsvColor}"
IsVisible="{TemplateBinding IsAlphaVisible}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Orientation="Vertical">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider>
</Grid>
</TabItem>
@@ -168,13 +175,13 @@
<ListBox
Margin="12"
VerticalAlignment="Stretch"
ItemContainerTheme="{DynamicResource ColorViewPaletteListBoxItemTheme}"
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}"
ItemsSource="{TemplateBinding PaletteColors}"
SelectedItem="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DoNothingForNullConverter}, Mode=TwoWay}"
Theme="{DynamicResource ColorViewPaletteListBoxTheme}"
SelectedItem="{TemplateBinding Color, Mode=TwoWay, Converter={StaticResource DoNothingForNullConverter}}"
Theme="{StaticResource ColorViewPaletteListBoxTheme}"
UseLayoutRounding="False">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type Color}">
<DataTemplate DataType="Color">
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -205,7 +212,11 @@
Margin="12"
ColumnDefinitions="Auto,*"
RowDefinitions="Auto,24,*,*,*,*,12"
Tag="{TemplateBinding ColorModel}">
UseLayoutRounding="False">
<Grid.Resources>
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
</Grid.Resources>
<Grid.Styles>
<Style Selector="NumericUpDown">
<Setter Property="InnerLeftContent">
@@ -214,34 +225,6 @@
</Template>
</Setter>
</Style>
<Style Selector="Grid[Tag=Rgba]">
<Style Selector="^ NumericUpDown#Component1NumericUpDown">
<Setter Property="Tag" Value="R" />
</Style>
<Style Selector="^ NumericUpDown#Component2NumericUpDown">
<Setter Property="Tag" Value="G" />
</Style>
<Style Selector="^ NumericUpDown#Component3NumericUpDown">
<Setter Property="Tag" Value="B" />
</Style>
<Style Selector="^ NumericUpDown#AlphaComponentNumericUpDown">
<Setter Property="Tag" Value="A" />
</Style>
</Style>
<Style Selector="Grid[Tag=Hsva]">
<Style Selector="^ NumericUpDown#Component1NumericUpDown">
<Setter Property="Tag" Value="H" />
</Style>
<Style Selector="^ NumericUpDown#Component2NumericUpDown">
<Setter Property="Tag" Value="S" />
</Style>
<Style Selector="^ NumericUpDown#Component3NumericUpDown">
<Setter Property="Tag" Value="V" />
</Style>
<Style Selector="^ NumericUpDown#AlphaComponentNumericUpDown">
<Setter Property="Tag" Value="A" />
</Style>
</Style>
</Grid.Styles>
<!-- Top color model & Hex input -->
<Grid
@@ -263,9 +246,9 @@
Content="RGB"
CornerRadius="3,0,0,3"
IsChecked="{TemplateBinding ColorModel,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Rgba},
Mode=TwoWay}"
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Rgba},
Mode=TwoWay}"
Theme="{DynamicResource ColorViewRadioButton}" />
<RadioButton
Name="HsvRadioButton"
@@ -275,9 +258,9 @@
Content="HSV"
CornerRadius="0,3,3,0"
IsChecked="{TemplateBinding ColorModel,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Hsva},
Mode=TwoWay}"
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Hsva},
Mode=TwoWay}"
Theme="{DynamicResource ColorViewRadioButton}" />
</Grid>
</Border>
@@ -302,11 +285,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component1Slider}"
Minimum="{Binding Minimum, ElementName=Component1Slider}"
Maximum="{Binding #Component1Slider.Maximum}"
Minimum="{Binding #Component1Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component1Slider}" />
Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component1Slider"
Grid.Row="2"
@@ -315,7 +298,7 @@
VerticalAlignment="Center"
ColorComponent="Component1"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -332,11 +315,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component2Slider}"
Minimum="{Binding Minimum, ElementName=Component2Slider}"
Maximum="{Binding #Component2Slider.Maximum}"
Minimum="{Binding #Component2Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component2Slider}" />
Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component2Slider"
Grid.Row="3"
@@ -345,7 +328,7 @@
VerticalAlignment="Center"
ColorComponent="Component2"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -362,11 +345,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component3Slider}"
Minimum="{Binding Minimum, ElementName=Component3Slider}"
Maximum="{Binding #Component3Slider.Maximum}"
Minimum="{Binding #Component3Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component3Slider}" />
Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component3Slider"
Grid.Row="4"
@@ -375,7 +358,7 @@
VerticalAlignment="Center"
ColorComponent="Component3"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -392,15 +375,15 @@
AllowSpin="True"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
Maximum="{Binding #AlphaComponentSlider.Maximum}"
Minimum="{Binding #AlphaComponentSlider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=AlphaComponentSlider}">
Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
<NumericUpDown.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentTextInputVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsAlphaVisible" />
<TemplateBinding Property="IsComponentTextInputVisible" />
</MultiBinding>
</NumericUpDown.IsVisible>
</NumericUpDown>
@@ -412,7 +395,7 @@
VerticalAlignment="Center"
ColorComponent="Alpha"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -420,8 +403,8 @@
TickFrequency="1">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsAlphaVisible" />
<TemplateBinding Property="IsComponentSliderVisible" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider>
@@ -429,11 +412,11 @@
</TabItem>
</TabControl>
<!-- Previewer -->
<!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
<!-- Note that the drop shadow is allowed to extend past the control bounds -->
<ColorPreviewer
Grid.Row="1"
Margin="12,-5,12,7"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Margin="12,0,12,12"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
IsVisible="{TemplateBinding IsColorPreviewVisible}" />
</Grid>
@@ -442,9 +425,33 @@
</DropDownButton>
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ DropDownButton">
<Setter Property="Padding" Value="0 0 10 0" />
<Style Selector="^[ColorModel=Rgba]">
<Style Selector="^ /template/ NumericUpDown#Component1NumericUpDown">
<Setter Property="Tag" Value="R" />
</Style>
<Style Selector="^ /template/ NumericUpDown#Component2NumericUpDown">
<Setter Property="Tag" Value="G" />
</Style>
<Style Selector="^ /template/ NumericUpDown#Component3NumericUpDown">
<Setter Property="Tag" Value="B" />
</Style>
<Style Selector="^ /template/ NumericUpDown#AlphaComponentNumericUpDown">
<Setter Property="Tag" Value="A" />
</Style>
</Style>
<Style Selector="^[ColorModel=Hsva]">
<Style Selector="^ /template/ NumericUpDown#Component1NumericUpDown">
<Setter Property="Tag" Value="H" />
</Style>
<Style Selector="^ /template/ NumericUpDown#Component2NumericUpDown">
<Setter Property="Tag" Value="S" />
</Style>
<Style Selector="^ /template/ NumericUpDown#Component3NumericUpDown">
<Setter Property="Tag" Value="V" />
</Style>
<Style Selector="^ /template/ NumericUpDown#AlphaComponentNumericUpDown">
<Setter Property="Tag" Value="A" />
</Style>
</Style>
</ControlTheme>
@@ -452,38 +459,34 @@
x:Key="HexColorPicker"
BasedOn="{StaticResource {x:Type ColorPicker}}"
TargetType="ColorPicker">
<Setter Property="MinWidth" Value="200" />
<Setter Property="Content">
<Template>
<Grid ColumnDefinitions="Auto, *">
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock
Grid.Column="1"
Margin="8,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontWeight="Regular"
Foreground="{DynamicResource TextBlockDefaultForeground}"
Text="{Binding $parent[ColorPicker].Color}" />
</Grid>
</Template>
</Setter>
<Setter Property="MinWidth" Value="180" />
<Setter Property="Content" Value="{StaticResource HexColorPickerTemplate}" />
</ControlTheme>
<Template x:Key="HexColorPickerTemplate">
<Grid ColumnDefinitions="Auto, *">
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{Binding $parent[ColorPicker].CornerRadius}" />
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
Background="{Binding $parent[ColorPicker].HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{Binding $parent[ColorPicker].CornerRadius}" />
<TextBlock
Grid.Column="1"
Margin="8,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{DynamicResource TextBlockDefaultForeground}">
<Run Text="#" />
<Run Text="{Binding $parent[ColorPicker].Color, Converter={StaticResource ColorToHexConverter}}" />
</TextBlock>
</Grid>
</Template>
<ControlTheme
x:Key="SimpleColorPicker"
@@ -491,12 +494,13 @@
TargetType="ColorPicker">
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorPicker}">
<ControlTemplate TargetType="ColorPicker">
<DropDownButton
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
@@ -511,14 +515,16 @@
</Style>
</DropDownButton.Styles>
<DropDownButton.Flyout>
<Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
<Flyout
FlyoutPresenterClasses="nopadding"
Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
<!--
The following is copy-pasted from the ColorView's control template.
It MUST always be kept in sync with the ColorView (which is master).
Note the only changes are resources specific to the ColorPicker.
-->
<Grid Width="280">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="280" />
<RowDefinition Height="Auto" />
@@ -534,6 +540,7 @@
Name="ColorSpectrum"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CornerRadius="8 8 0 0"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
@@ -584,35 +591,43 @@
CornerRadius="4" />
<Panel
Name="PART_TextBoxPanel"
Width="106"
Width="116"
Margin="4 0 0 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<TextBox
Name="PART_HexTextBox"
AutomationProperties.Name="Hexadecimal Color"
Classes="Small"
CornerRadius="3 0 0 3"
InnerLeftContent="#"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
MaxLength="8" />
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}"
MaxLength="8">
<TextBox.Resources>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 4 0</Thickness>
</TextBox.Resources>
</TextBox>
<TextBox
Name="PART_RgbaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
CornerRadius="3 0 0 3"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}"
Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" />
<TextBox
Name="PART_HsvaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
CornerRadius="3 0 0 3"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}"
Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" />
</Panel>
<NumericUpDown
Name="AlphaComponentNumericUpDown"
Width="70"
Width="60"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AllowSpin="True"
CornerRadius="0"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
@@ -621,14 +636,21 @@
ShowButtonSpinner="False"
InnerRightContent="%"
IsVisible="{TemplateBinding IsAlphaVisible}"
Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
<NumericUpDown.Resources>
<Thickness x:Key="TextBoxContentPadding">12 0 4 0</Thickness>
<Thickness x:Key="TextBoxInnerRightContentPadding">4 0 0 0</Thickness>
</NumericUpDown.Resources>
</NumericUpDown>
<ComboBox
Name="ColorModelComboBox"
Width="80"
CornerRadius="0 3 3 0"
VerticalAlignment="Center"
Classes="Small"
SelectedValue="Hex">
Hex<ColorModel>Rgba</ColorModel>
<x:String>Hex</x:String>
<ColorModel>Rgba</ColorModel>
<ColorModel>Hsva</ColorModel>
</ComboBox>
</StackPanel>
@@ -647,37 +669,8 @@
x:Key="HexSimpleColorPicker"
BasedOn="{StaticResource SimpleColorPicker}"
TargetType="ColorPicker">
<Setter Property="MinWidth" Value="200" />
<Setter Property="Content">
<Template>
<Grid ColumnDefinitions="Auto, *">
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock
Grid.Column="1"
Margin="8,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontWeight="Regular"
Foreground="{DynamicResource TextBlockDefaultForeground}"
Text="{Binding $parent[ColorPicker].Color}" />
</Grid>
</Template>
</Setter>
<Setter Property="MinWidth" Value="180" />
<Setter Property="Content" Value="{StaticResource HexColorPickerTemplate}" />
</ControlTheme>
</ResourceDictionary>

View File

@@ -1,15 +1,13 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters">
<pc:AccentColorConverter x:Key="AccentColorConverter" />
xmlns:iri="https://irihi.tech/shared">
<ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer">
<Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorPreviewerCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorPreviewer}">
<ControlTemplate TargetType="ColorPreviewer">
<Panel>
<!-- Preview color with accents to the left and right -->
<Grid ColumnDefinitions="Auto,*,Auto" IsVisible="{TemplateBinding IsAccentColorsVisible}">

View File

@@ -1,9 +1,6 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="ColorSliderThumbTheme" TargetType="Thumb">
<Setter Property="Background" Value="Transparent" />
@@ -12,7 +9,7 @@
<Setter Property="BorderThickness" Value="{DynamicResource ColorSliderThumbBorderBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderThumbCornerRadius}" />
<Setter Property="Template">
<ControlTemplate>
<ControlTemplate TargetType="Thumb">
<Border
Margin="1"
Background="{TemplateBinding Background}"
@@ -30,33 +27,30 @@
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
<Setter Property="Height" Value="{DynamicResource ColorSliderWidth}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorSlider}">
<ControlTemplate TargetType="ColorSlider">
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}">
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
Height="{Binding #PART_Track.Bounds.Height}"
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{DynamicResource ColorControlCheckeredBackgroundBrush}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
VerticalAlignment="Center"
Height="{Binding #PART_Track.Bounds.Height}"
Background="{StaticResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{TemplateBinding Background}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
VerticalAlignment="Center"
Height="{Binding #PART_Track.Bounds.Height}"
Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Track
Name="PART_Track"
Height="12"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
VerticalAlignment="Center"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
@@ -101,7 +95,7 @@
Width="{TemplateBinding Height}"
Height="{TemplateBinding Height}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource ColorSliderThumbTheme}" />
Theme="{DynamicResource ColorSliderThumbTheme}" />
</Track>
</Grid>
</Border>
@@ -114,32 +108,28 @@
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
<Setter Property="Width" Value="{DynamicResource ColorSliderWidth}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorSlider}">
<ControlTemplate TargetType="ColorSlider">
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}">
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
Height="{Binding #PART_Track.Bounds.Height}"
HorizontalAlignment="Stretch"
<Border
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Fill="{DynamicResource ColorControlCheckeredBackgroundBrush}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
Height="{Binding #PART_Track.Bounds.Height}"
HorizontalAlignment="Stretch"
Background="{StaticResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Border
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Fill="{TemplateBinding Background}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
Width="{Binding #PART_Track.Bounds.Width}"
Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Track
Name="PART_Track"
Width="12"
HorizontalAlignment="Stretch"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}"
@@ -185,7 +175,7 @@
Width="{TemplateBinding Width}"
Height="{TemplateBinding Width}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource ColorSliderThumbTheme}" />
Theme="{DynamicResource ColorSliderThumbTheme}" />
</Track>
</Grid>
</Border>

View File

@@ -1,15 +1,11 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type ColorSpectrum}" TargetType="ColorSpectrum">
<Setter Property="CornerRadius" Value="{DynamicResource ColorSpectrumCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorSpectrum}">
<ControlTemplate TargetType="ColorSpectrum">
<Panel
Name="PART_LayoutRoot"
HorizontalAlignment="Stretch"
@@ -25,27 +21,27 @@
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
<Rectangle
Name="PART_SpectrumOverlayRectangle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
<Ellipse
Name="PART_SpectrumEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
<Ellipse
Name="PART_SpectrumOverlayEllipse"
@@ -53,7 +49,7 @@
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
<Canvas
Name="PART_InputTarget"
@@ -89,17 +85,17 @@
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
<Ellipse
Name="BorderEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
</Panel>
</Panel>

View File

@@ -1,28 +1,23 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:globalization="using:System.Globalization"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
xmlns:cvts="clr-namespace:Semi.Avalonia.ColorPicker.Converters">
<pc:ContrastBrushConverter x:Key="ContrastBrushConverter" />
<converters:ColorToDisplayNameConverter x:Key="ColorToDisplayNameConverter" />
<converters:ColorToHexConverter x:Key="ColorToHexConverter" />
<converters:DoNothingForNullConverter x:Key="DoNothingForNullConverter" />
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<converters:ToBrushConverter x:Key="ToBrushConverter" />
<cvts:HsvColorToTextConverter x:Key="HsvColorToTextConverter" />
<cvts:ColorToTextConverter x:Key="ColorToTextConverter" />
<cvts:ToColorModel x:Key="ToColorModel" />
<globalization:NumberFormatInfo x:Key="ColorViewComponentNumberFormat" NumberDecimalDigits="0" />
xmlns:semi="https://irihi.tech/semi">
<Design.PreviewWith>
<ColorView
Theme="{StaticResource SimpleColorView}"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
<StackPanel>
<ColorView
SelectedIndex="2"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
<ColorView
Theme="{DynamicResource SimpleColorView}"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
</StackPanel>
</Design.PreviewWith>
<VisualBrush
@@ -32,16 +27,12 @@
TileMode="Tile">
<VisualBrush.Visual>
<Image Width="8" Height="8">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="Transparent" Geometry="M0,0 L2,0 2,2, 0,2Z" />
<GeometryDrawing Brush="#19808080" Geometry="M0,1 L2,1 2,2, 1,2 1,0 0,0Z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
<DrawingImage>
<DrawingGroup>
<GeometryDrawing Brush="Transparent" Geometry="M0 0H2V2H0Z" />
<GeometryDrawing Brush="#19808080" Geometry="M0 1H2V2H1V0H0Z" />
</DrawingGroup>
</DrawingImage>
</Image>
</VisualBrush.Visual>
</VisualBrush>
@@ -61,11 +52,11 @@
CornerRadius="{TemplateBinding CornerRadius}">
<ScrollViewer
Name="PART_ScrollViewer"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
AllowAutoHide="{TemplateBinding ScrollViewer.AllowAutoHide}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
IsScrollChainingEnabled="{TemplateBinding ScrollViewer.IsScrollChainingEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter
Name="PART_ItemsPresenter"
Margin="{TemplateBinding Padding}"
@@ -82,8 +73,8 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid UseLayoutRounding="False">
<ControlTemplate TargetType="ListBoxItem">
<Panel UseLayoutRounding="False">
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
@@ -101,7 +92,7 @@
VerticalAlignment="Stretch"
IsHitTestVisible="False"
StrokeThickness="1" />
</Grid>
</Panel>
</ControlTemplate>
</Setter>
@@ -141,12 +132,14 @@
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
RecognizesAccessKey="True"
TextElement.FontSize="{TemplateBinding FontSize}"
TextElement.FontWeight="{TemplateBinding FontWeight}"
UseLayoutRounding="False" />
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="RecognizesAccessKey" Value="True" />
</Style>
<Style Selector="^:checked">
<Setter Property="Background" Value="{DynamicResource ColorViewRadioButtonCheckedBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ColorViewRadioButtonCheckedForeground}" />
@@ -168,14 +161,14 @@
</ControlTheme>
<ControlTheme x:Key="{x:Type ColorView}" TargetType="ColorView">
<!-- Alpha position should match CSS (and default slider order) instead of XAML/WinUI -->
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Width" Value="300" />
<Setter Property="Height" Value="300" />
<Setter Property="Palette">
<FluentColorPalette />
</Setter>
<Setter Property="Palette" Value="{DynamicResource SemiColorPalette}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorView}">
<ControlTemplate TargetType="ColorView">
<Grid RowDefinitions="*,Auto">
<!-- Backgrounds -->
<!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" -->
@@ -197,7 +190,7 @@
Padding="0"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
<TabControl.Styles>
<Style Selector="TabItem">
<Setter Property="MinHeight" Value="32" />
@@ -232,11 +225,11 @@
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
AutomationProperties.Name="Third Component"
ColorComponent="{Binding ThirdComponent, ElementName=ColorSpectrum}"
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}"
ColorModel="Hsva"
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsAlphaVisible="True"
IsPerceptive="False"
HsvColor="{Binding #ColorSpectrum.HsvColor}"
IsAlphaVisible="False"
IsPerceptive="True"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Vertical" />
<ColorSpectrum
@@ -245,7 +238,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
MaxSaturation="{TemplateBinding MaxSaturation}"
MaxValue="{TemplateBinding MaxValue}"
@@ -262,14 +255,10 @@
AutomationProperties.Name="Alpha Component"
ColorComponent="Alpha"
ColorModel="Hsva"
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
HsvColor="{Binding #ColorSpectrum.HsvColor}"
IsVisible="{TemplateBinding IsAlphaVisible}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Orientation="Vertical">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider>
</Grid>
</TabItem>
@@ -286,11 +275,11 @@
VerticalAlignment="Stretch"
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}"
ItemsSource="{TemplateBinding PaletteColors}"
SelectedItem="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DoNothingForNullConverter}, Mode=TwoWay}"
SelectedItem="{TemplateBinding Color, Mode=TwoWay, Converter={StaticResource DoNothingForNullConverter}}"
Theme="{StaticResource ColorViewPaletteListBoxTheme}"
UseLayoutRounding="False">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type Color}">
<DataTemplate DataType="Color">
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -322,6 +311,10 @@
ColumnDefinitions="Auto,*"
RowDefinitions="Auto,24,*,*,*,*,12"
UseLayoutRounding="False">
<Grid.Resources>
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
</Grid.Resources>
<Grid.Styles>
<Style Selector="NumericUpDown">
<Setter Property="InnerLeftContent">
@@ -351,9 +344,9 @@
Content="RGB"
CornerRadius="3,0,0,3"
IsChecked="{TemplateBinding ColorModel,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Rgba},
Mode=TwoWay}"
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Rgba},
Mode=TwoWay}"
Theme="{DynamicResource ColorViewRadioButton}" />
<RadioButton
Name="HsvRadioButton"
@@ -363,9 +356,9 @@
Content="HSV"
CornerRadius="0,3,3,0"
IsChecked="{TemplateBinding ColorModel,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Hsva},
Mode=TwoWay}"
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Hsva},
Mode=TwoWay}"
Theme="{DynamicResource ColorViewRadioButton}" />
</Grid>
</Border>
@@ -390,11 +383,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component1Slider}"
Minimum="{Binding Minimum, ElementName=Component1Slider}"
Maximum="{Binding #Component1Slider.Maximum}"
Minimum="{Binding #Component1Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component1Slider}" />
Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component1Slider"
Grid.Row="2"
@@ -403,7 +396,7 @@
VerticalAlignment="Center"
ColorComponent="Component1"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -420,11 +413,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component2Slider}"
Minimum="{Binding Minimum, ElementName=Component2Slider}"
Maximum="{Binding #Component2Slider.Maximum}"
Minimum="{Binding #Component2Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component2Slider}" />
Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component2Slider"
Grid.Row="3"
@@ -433,7 +426,7 @@
VerticalAlignment="Center"
ColorComponent="Component2"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -450,11 +443,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component3Slider}"
Minimum="{Binding Minimum, ElementName=Component3Slider}"
Maximum="{Binding #Component3Slider.Maximum}"
Minimum="{Binding #Component3Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component3Slider}" />
Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component3Slider"
Grid.Row="4"
@@ -463,7 +456,7 @@
VerticalAlignment="Center"
ColorComponent="Component3"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -480,15 +473,15 @@
AllowSpin="True"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
Maximum="{Binding #AlphaComponentSlider.Maximum}"
Minimum="{Binding #AlphaComponentSlider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=AlphaComponentSlider}">
Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
<NumericUpDown.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentTextInputVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsAlphaVisible" />
<TemplateBinding Property="IsComponentTextInputVisible" />
</MultiBinding>
</NumericUpDown.IsVisible>
</NumericUpDown>
@@ -500,7 +493,7 @@
VerticalAlignment="Center"
ColorComponent="Alpha"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -508,8 +501,8 @@
TickFrequency="1">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsAlphaVisible" />
<TemplateBinding Property="IsComponentSliderVisible" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider>
@@ -517,11 +510,11 @@
</TabItem>
</TabControl>
<!-- Previewer -->
<!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
<!-- Note that the drop shadow is allowed to extend past the control bounds -->
<ColorPreviewer
Grid.Row="1"
Margin="12,-5,12,7"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Margin="12,0,12,12"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
IsVisible="{TemplateBinding IsColorPreviewVisible}" />
</Grid>
@@ -558,11 +551,12 @@
</ControlTheme>
<ControlTheme x:Key="SimpleColorView" TargetType="ColorView">
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
<Setter Property="Width" Value="280" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorView}">
<ControlTemplate TargetType="ColorView">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="280" />
@@ -579,6 +573,7 @@
Name="ColorSpectrum"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CornerRadius="8 8 0 0"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
@@ -602,7 +597,7 @@
Orientation="Horizontal" />
<ColorSlider
x:Name="ColorSpectrumAlphaSlider"
Name="ColorSpectrumAlphaSlider"
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
@@ -629,35 +624,43 @@
CornerRadius="4" />
<Panel
Name="PART_TextBoxPanel"
Width="106"
Width="116"
Margin="4 0 0 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<TextBox
Name="PART_HexTextBox"
AutomationProperties.Name="Hexadecimal Color"
Classes="Small"
CornerRadius="3 0 0 3"
InnerLeftContent="#"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
MaxLength="8" />
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}"
MaxLength="8">
<TextBox.Resources>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 4 0</Thickness>
</TextBox.Resources>
</TextBox>
<TextBox
Name="PART_RgbaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
CornerRadius="3 0 0 3"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}"
Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" />
<TextBox
Name="PART_HsvaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
CornerRadius="3 0 0 3"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}"
Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" />
</Panel>
<NumericUpDown
Name="AlphaComponentNumericUpDown"
Width="70"
Width="60"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AllowSpin="True"
CornerRadius="0"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
@@ -666,14 +669,21 @@
ShowButtonSpinner="False"
InnerRightContent="%"
IsVisible="{TemplateBinding IsAlphaVisible}"
Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
<NumericUpDown.Resources>
<Thickness x:Key="TextBoxContentPadding">12 0 4 0</Thickness>
<Thickness x:Key="TextBoxInnerRightContentPadding">4 0 0 0</Thickness>
</NumericUpDown.Resources>
</NumericUpDown>
<ComboBox
Name="ColorModelComboBox"
Width="80"
CornerRadius="0 3 3 0"
VerticalAlignment="Center"
Classes="Small"
SelectedValue="Hex">
Hex<ColorModel>Rgba</ColorModel>
<x:String>Hex</x:String>
<ColorModel>Rgba</ColorModel>
<ColorModel>Hsva</ColorModel>
</ComboBox>
</StackPanel>

View File

@@ -0,0 +1,17 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
xmlns:globalization="using:System.Globalization">
<pc:ContrastBrushConverter x:Key="ContrastBrushConverter" />
<pc:AccentColorConverter x:Key="AccentColorConverter" />
<converters:ColorToDisplayNameConverter x:Key="ColorToDisplayNameConverter" />
<converters:DoNothingForNullConverter x:Key="DoNothingForNullConverter" />
<converters:ToBrushConverter x:Key="ToBrushConverter" />
<converters:ColorToHexConverter x:Key="ColorToHexConverter" AlphaPosition="Trailing" IsAlphaVisible="True" />
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<globalization:NumberFormatInfo x:Key="ColorViewComponentNumberFormat" NumberDecimalDigits="0" />
</ResourceDictionary>

View File

@@ -2,6 +2,7 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="Converters.axaml" />
<ResourceInclude Source="ColorPicker.axaml" />
<ResourceInclude Source="ColorPreviewer.axaml" />
<ResourceInclude Source="ColorSlider.axaml" />

View File

@@ -3,19 +3,19 @@ using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Irihi.Avalonia.Shared.Converters;
namespace Semi.Avalonia.ColorPicker.Converters;
public class ColorToTextConverter : IValueConverter
public class ColorToTextConverter : MarkupValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is Color color ? $"{color.R},{color.G},{color.B},{color.A}" : AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not string str) return BindingOperations.DoNothing;
var parts = str.Split(',');

View File

@@ -3,21 +3,21 @@ using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Irihi.Avalonia.Shared.Converters;
namespace Semi.Avalonia.ColorPicker.Converters;
public class HsvColorToTextConverter : IValueConverter
public class HsvColorToTextConverter : MarkupValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is HsvColor hsvColor
? $"{Math.Round(hsvColor.H)},{Math.Round(hsvColor.S * 100)},{Math.Round(hsvColor.V * 100)},{Math.Round(hsvColor.A * 100)}"
: AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not string str) return BindingOperations.DoNothing;
var parts = str.Split(',');

View File

@@ -1,21 +0,0 @@
using System;
using System.Globalization;
using Avalonia.Controls;
using Avalonia.Data.Converters;
namespace Semi.Avalonia.ColorPicker.Converters;
public class ToColorModel : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return parameter is "Hex" && value is "Hex" ||
parameter is "Rgba" && value is ColorModel.Rgba ||
parameter is "Hsva" && value is ColorModel.Hsva;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -3,6 +3,7 @@
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceInclude x:Key="Default" Source="Light.axaml" />
<ResourceInclude x:Key="Light" Source="Light.axaml" />
<ResourceInclude x:Key="Dark" Source="Dark.axaml" />
</ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries>

View File

@@ -1,3 +1,5 @@
using Avalonia.Metadata;
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker")]
[assembly: XmlnsPrefix("https://irihi.tech/semi", "semi")]
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker")]
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker.Converters")]

View File

@@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.0-rc1</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.0-rc1</PackageReleaseNotes>
<Version>12.0.0</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.0</PackageReleaseNotes>
<Title>Semi.Avalonia.ColorPicker</Title>
</PropertyGroup>

View File

@@ -1,13 +1,12 @@
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Utilities;
using Irihi.Avalonia.Shared.Helpers;
namespace Semi.Avalonia.ColorPicker;
public class SemiColorDarkPalette: IColorPalette
public class SemiColorDarkPalette : IColorPalette
{
private static readonly Color[,] Colors = new Color[,]
private static readonly Color[,] Colors = new[,]
{
{
//Red
@@ -217,7 +216,21 @@ public class SemiColorDarkPalette: IColorPalette
Color.FromUInt32(0xFFE6E8EA),
Color.FromUInt32(0xFFF9F9F9),
},
{
//AIPurple
Color.FromUInt32(0xFF3A1770),
Color.FromUInt32(0xFF532394),
Color.FromUInt32(0xFF6F31B8),
Color.FromUInt32(0xFF8D41DB),
Color.FromUInt32(0xFFA744FF),
Color.FromUInt32(0xFFC375FF),
Color.FromUInt32(0xFFD598FF),
Color.FromUInt32(0xFFE5BAFF),
Color.FromUInt32(0xFFF3DDFF),
Color.FromUInt32(0xFFFBF3FF),
},
};
public Color GetColor(int colorIndex, int shadeIndex)
{
return Colors[
@@ -229,4 +242,4 @@ public class SemiColorDarkPalette: IColorPalette
public int ColorCount => Colors.GetLength(0);
public int ShadeCount => Colors.GetLength(1);
}
}

View File

@@ -1,13 +1,12 @@
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Utilities;
using Irihi.Avalonia.Shared.Helpers;
namespace Semi.Avalonia.ColorPicker;
public class SemiColorLightPalette: IColorPalette
public class SemiColorLightPalette : IColorPalette
{
private static readonly Color[,] Colors = new Color[,]
private static readonly Color[,] Colors = new[,]
{
{
//Red
@@ -217,7 +216,21 @@ public class SemiColorLightPalette: IColorPalette
Color.FromUInt32(0xFF2E3238),
Color.FromUInt32(0xFF1C1F23),
},
{
//AIPurple
Color.FromUInt32(0xFFF8EDFF),
Color.FromUInt32(0xFFF2DAFF),
Color.FromUInt32(0xFFE3B5FF),
Color.FromUInt32(0xFFD191FF),
Color.FromUInt32(0xFFBD6CFF),
Color.FromUInt32(0xFFA647FF),
Color.FromUInt32(0xFF8636DB),
Color.FromUInt32(0xFF6928B8),
Color.FromUInt32(0xFF4E1C94),
Color.FromUInt32(0xFF361270),
},
};
public Color GetColor(int colorIndex, int shadeIndex)
{
return Colors[

View File

@@ -3,6 +3,7 @@
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceInclude x:Key="Default" Source="Light.axaml" />
<ResourceInclude x:Key="Light" Source="Light.axaml" />
<ResourceInclude x:Key="Dark" Source="Dark.axaml" />
</ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries>

View File

@@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.0-rc1</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 12.0.0-rc1</PackageReleaseNotes>
<Version>12.0.0</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 12.0.0</PackageReleaseNotes>
<Title>Semi.Avalonia.DataGrid</Title>
</PropertyGroup>

View File

@@ -4,7 +4,7 @@
<ControlTheme x:Key="{x:Type CarouselPage}" TargetType="CarouselPage">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<ControlTemplate>
<ControlTemplate TargetType="CarouselPage">
<Carousel
Name="PART_Carousel"
Background="{TemplateBinding Background}"

View File

@@ -16,28 +16,27 @@
<ControlTheme x:Key="{x:Type ContentPage}" TargetType="ContentPage">
<Setter Property="Background" Value="{DynamicResource ContentPageBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ContentPageForeground}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="ContentPage">
<Grid RowDefinitions="Auto,*,Auto" Background="{TemplateBinding Background}">
<DockPanel>
<ContentPresenter
Name="PART_TopCommandBar"
Grid.Row="0"
Content="{TemplateBinding TopCommandBar}" />
<ContentPresenter
Name="PART_ContentPresenter"
Grid.Row="1"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
DockPanel.Dock="Top" />
<ContentPresenter
Name="PART_BottomCommandBar"
Grid.Row="2"
Content="{TemplateBinding BottomCommandBar}" />
</Grid>
DockPanel.Dock="Bottom" />
<ContentPresenter
Name="PART_ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</DockPanel>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -1,6 +1,4 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<DrawerPage Width="400" Height="300" />
</Design.PreviewWith>
@@ -8,142 +6,247 @@
<ControlTheme x:Key="{x:Type DrawerPage}" TargetType="DrawerPage">
<Setter Property="Background" Value="{DynamicResource DrawerPageBackground}" />
<Setter Property="Foreground" Value="{DynamicResource DrawerPageForeground}" />
<Setter Property="DrawerBackground" Value="{DynamicResource DrawerPageDrawerBackground}" />
<Setter Property="DrawerLength" Value="{DynamicResource DrawerPageDrawerLength}" />
<Setter Property="CompactDrawerLength" Value="{DynamicResource DrawerPageCompactDrawerLength}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="DrawerPage">
<Grid RowDefinitions="Auto,*" Background="{TemplateBinding Background}">
<!-- Top bar with pane toggle button -->
<Border
Name="PART_TopBar"
Grid.Row="0"
MinHeight="{DynamicResource DrawerPageTopBarMinHeight}"
Padding="{DynamicResource DrawerPageTopBarPadding}"
Background="{DynamicResource DrawerPageTopBarBackground}"
BorderBrush="{DynamicResource DrawerPageTopBarBorderBrush}"
BorderThickness="{DynamicResource DrawerPageTopBarBorderThickness}">
<Grid ColumnDefinitions="Auto,Auto,*">
<!-- Pane toggle button (hamburger) -->
<SplitView
Name="PART_SplitView"
CompactPaneLength="{TemplateBinding CompactDrawerLength}"
DisplayMode="{TemplateBinding DisplayMode}"
IsPaneOpen="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
OpenPaneLength="{TemplateBinding DrawerLength}"
PaneBackground="{Binding DrawerBackground, RelativeSource={RelativeSource TemplatedParent}}">
<SplitView.Pane>
<DockPanel Background="{TemplateBinding DrawerBackground}">
<!-- Compact-mode toggle: visible only in CompactOverlay/CompactInline. -->
<ToggleButton
Name="PART_PaneButton"
Grid.Column="0"
Width="{DynamicResource DrawerPagePaneButtonSize}"
Height="{DynamicResource DrawerPagePaneButtonSize}"
Margin="{DynamicResource DrawerPagePaneButtonMargin}"
VerticalAlignment="Center"
Background="{DynamicResource DrawerPagePaneButtonBackground}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsChecked="{TemplateBinding IsOpen, Mode=TwoWay}">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource DrawerPageMenuGlyph}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}" />
</ToggleButton>
<!-- Drawer icon (shown in top bar) -->
<ContentPresenter
Name="PART_PaneIconPresenter"
Grid.Column="1"
VerticalAlignment="Center"
Content="{TemplateBinding DrawerIcon}"
ContentTemplate="{TemplateBinding DrawerIconTemplate}" />
</Grid>
</Border>
<!-- Main area: SplitView + Backdrop -->
<Panel Grid.Row="1">
<SplitView
Name="PART_SplitView"
CompactPaneLength="{TemplateBinding CompactDrawerLength}"
DisplayMode="{TemplateBinding DisplayMode}"
IsPaneOpen="{TemplateBinding IsOpen, Mode=TwoWay}"
OpenPaneLength="{TemplateBinding DrawerLength}"
PaneBackground="{TemplateBinding DrawerBackground}">
<SplitView.Pane>
<DockPanel>
<!-- Drawer header -->
<ContentPresenter
Name="PART_DrawerHeader"
DockPanel.Dock="Top"
Background="{TemplateBinding DrawerHeaderBackground}"
Content="{TemplateBinding DrawerHeader}"
ContentTemplate="{TemplateBinding DrawerHeaderTemplate}" />
<!-- Drawer footer -->
<ContentPresenter
Name="PART_DrawerFooter"
DockPanel.Dock="Bottom"
Background="{TemplateBinding DrawerFooterBackground}"
Content="{TemplateBinding DrawerFooter}"
ContentTemplate="{TemplateBinding DrawerFooterTemplate}" />
<!-- Compact pane icon (compact mode) -->
Name="PART_CompactPaneToggle"
Width="{DynamicResource ButtonDefaultHeight}"
Height="{DynamicResource ButtonDefaultHeight}"
HorizontalAlignment="Left"
AutomationProperties.Name="Toggle navigation drawer"
Background="Transparent"
DockPanel.Dock="Top"
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
IsVisible="False"
ToolTip.Tip="Toggle navigation drawer">
<Panel>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DrawerPageMenuGlyph}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
Theme="{DynamicResource InnerPathIcon}" />
<ContentPresenter
Name="PART_CompactPaneIconPresenter"
DockPanel.Dock="Top"
IsVisible="False"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding DrawerIcon}"
ContentTemplate="{TemplateBinding DrawerIconTemplate}" />
<!-- Bottom pane icon -->
<ContentPresenter
Name="PART_BottomPaneIconPresenter"
DockPanel.Dock="Bottom"
IsVisible="False"
Content="{TemplateBinding DrawerIcon}"
ContentTemplate="{TemplateBinding DrawerIconTemplate}" />
<!-- Drawer main content -->
<ContentPresenter
Name="PART_DrawerPresenter"
Content="{TemplateBinding Drawer}"
ContentTemplate="{TemplateBinding DrawerTemplate}" />
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Panel>
</ToggleButton>
<ContentPresenter
Name="PART_DrawerHeader"
Background="{TemplateBinding DrawerHeaderBackground}"
Content="{TemplateBinding DrawerHeader}"
ContentTemplate="{TemplateBinding DrawerHeaderTemplate}"
DockPanel.Dock="Top"
IsVisible="{TemplateBinding DrawerHeader,
Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="PART_DrawerFooter"
Background="{TemplateBinding DrawerFooterBackground}"
Content="{TemplateBinding DrawerFooter}"
ContentTemplate="{TemplateBinding DrawerFooterTemplate}"
DockPanel.Dock="Bottom"
IsVisible="{TemplateBinding DrawerFooter,
Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="PART_DrawerPresenter"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{TemplateBinding Drawer}"
ContentTemplate="{TemplateBinding DrawerTemplate}" />
</DockPanel>
</SplitView.Pane>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<DockPanel Name="PART_ContentDock">
<Border
Name="PART_TopBar"
Height="{DynamicResource DrawerPageTopBarMinHeight}"
Padding="5"
Background="{DynamicResource DrawerPageTopBarBackground}"
DockPanel.Dock="Top">
<DockPanel HorizontalAlignment="Stretch">
<ToggleButton
Name="PART_PaneButton"
Width="{DynamicResource ButtonDefaultHeight}"
Height="{DynamicResource ButtonDefaultHeight}"
AutomationProperties.Name="Toggle navigation drawer"
Background="Transparent"
DockPanel.Dock="Left"
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
ToolTip.Tip="Toggle navigation drawer">
<Panel>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DrawerPageMenuGlyph}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
Theme="{DynamicResource InnerPathIcon}" />
<ContentPresenter
Name="PART_PaneIconPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding DrawerIcon}"
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Panel>
</ToggleButton>
<ContentControl
Name="PART_TitlePresenter"
Margin="8,0,0,0"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Header}"
FontSize="16"
FontWeight="SemiBold"
IsVisible="{TemplateBinding Header,
Converter={x:Static ObjectConverters.IsNotNull}}" />
</DockPanel>
</SplitView.Pane>
<!-- Main page content -->
</Border>
<Border
Name="PART_BottomBar"
Height="{DynamicResource DrawerPageTopBarMinHeight}"
Padding="5"
Background="{DynamicResource DrawerPageTopBarBackground}"
DockPanel.Dock="Bottom"
IsVisible="False">
<DockPanel HorizontalAlignment="Stretch">
<ToggleButton
Name="PART_BottomPaneButton"
AutomationProperties.Name="Toggle navigation drawer"
Background="Transparent"
DockPanel.Dock="Left"
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
ToolTip.Tip="Toggle navigation drawer">
<Panel>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DrawerPaneButtonIcon}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
Theme="{DynamicResource InnerPathIcon}" />
<ContentPresenter
Name="PART_BottomPaneIconPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding DrawerIcon}"
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Panel>
</ToggleButton>
<ContentControl
Name="PART_BottomTitlePresenter"
Margin="8,0,0,0"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Header}"
FontSize="16"
FontWeight="SemiBold"
IsVisible="{TemplateBinding Header,
Converter={x:Static ObjectConverters.IsNotNull}}" />
</DockPanel>
</Border>
<ContentPresenter
Name="PART_ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</SplitView>
<!-- Backdrop overlay (shown in overlay/flyout modes) -->
CornerRadius="{TemplateBinding CornerRadius}" />
</DockPanel>
<Border
Name="PART_Backdrop"
Background="{TemplateBinding BackdropBrush}"
IsHitTestVisible="False"
IsVisible="False" />
<!-- Compact pane toggle -->
<ToggleButton
Name="PART_CompactPaneToggle"
IsVisible="False" />
</Panel>
</Grid>
</Grid>
</SplitView>
</ControlTemplate>
</Setter>
<!-- Pseudo-class: right-side drawer -->
<Style Selector="^:placement-right /template/ SplitView#PART_SplitView">
<Setter Property="PanePlacement" Value="Right" />
<Style Selector="^:placement-right /template/ ToggleButton#PART_PaneButton">
<Setter Property="DockPanel.Dock" Value="Right" />
</Style>
<!-- Pseudo-class: top drawer -->
<Style Selector="^:placement-top /template/ SplitView#PART_SplitView">
<Setter Property="PanePlacement" Value="Top" />
<!-- Bottom placement: swap top bar for bottom bar -->
<Style Selector="^:placement-bottom /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:placement-bottom /template/ Border#PART_BottomBar">
<Setter Property="IsVisible" Value="True" />
</Style>
<!-- Pseudo-class: bottom drawer -->
<Style Selector="^:placement-bottom /template/ SplitView#PART_SplitView">
<Setter Property="PanePlacement" Value="Bottom" />
<!-- Bottom placement + compact modes: pane compact strip provides toggle, hide bottom bar -->
<Style Selector="^:placement-bottom[DisplayMode=CompactOverlay] /template/ Border#PART_BottomBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:placement-bottom[DisplayMode=CompactInline] /template/ Border#PART_BottomBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<!-- Horizontal pane (Bottom/Top): compact toggle must dock Left so drawer content can fill the rest -->
<Style Selector="^:placement-bottom /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="DockPanel.Dock" Value="Left" />
</Style>
<Style Selector="^:placement-top /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="DockPanel.Dock" Value="Left" />
</Style>
<Style Selector="^[DrawerBehavior=Locked] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^[DrawerBehavior=Disabled] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:detail-is-navpage /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^[DisplayMode=CompactOverlay] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^[DisplayMode=CompactOverlay] /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^[DisplayMode=CompactInline] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^[DisplayMode=CompactInline] /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^[IsInNavigationPage=True] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<!-- NavigationPage already hosts a hamburger toggle — suppress the compact pane toggle. -->
<Style Selector="^:detail-is-navpage /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="IsVisible" Value="False" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -6,89 +6,118 @@
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type NavigationPage}" TargetType="NavigationPage">
<Setter Property="Background" Value="{DynamicResource NavigationPageBackground}" />
<Setter Property="Foreground" Value="{DynamicResource NavigationPageForeground}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BarHeight" Value="{DynamicResource NavigationPageBarMinHeight}" />
<Setter Property="Template">
<ControlTemplate TargetType="NavigationPage">
<Grid RowDefinitions="Auto,*,Auto" Background="{TemplateBinding Background}">
<!-- Top command bar -->
<ContentPresenter
Name="PART_TopCommandBar"
Grid.Row="0" />
<!-- Content host (pages + navigation bar) -->
<Panel Name="PART_ContentHost" Grid.Row="1">
<!-- Previous page (back animation target) -->
<ContentPresenter Name="PART_PageBackPresenter" />
<!-- Current page -->
<ContentPresenter Name="PART_PagePresenter" />
<!-- Modal back page -->
<ContentPresenter Name="PART_ModalBackPresenter" />
<!-- Modal page -->
<ContentPresenter Name="PART_ModalPresenter" />
<!-- Navigation bar (overlaid on content by default) -->
<Panel ClipToBounds="True">
<DockPanel>
<Border
Name="PART_NavigationBar"
MinHeight="{TemplateBinding BarHeight}"
Padding="{DynamicResource NavigationPageBarPadding}"
VerticalAlignment="Top"
Background="{DynamicResource NavigationPageBarBackground}"
BorderBrush="{DynamicResource NavigationPageBarBorderBrush}"
BorderThickness="{DynamicResource NavigationPageBarBorderThickness}">
<Grid ColumnDefinitions="Auto,*,Auto">
<Button
Name="PART_BackButton"
Grid.Column="0"
MinHeight="{DynamicResource NavigationPageBarMinHeight}"
MinWidth="{DynamicResource NavigationPageBarMinHeight}"
Padding="8"
VerticalAlignment="Center"
IsVisible="{TemplateBinding IsBackButtonEffectivelyVisible}"
Background="{DynamicResource NavigationPageBackButtonBackground}"
Theme="{StaticResource BorderlessButton}">
<Panel Background="Transparent">
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Classes="Large"
Data="{DynamicResource NavigationPageBackButtonGlyph}"
Foreground="{DynamicResource NavigationPageBackButtonForeground}"
IsVisible="{Binding CurrentPage?.(NavigationPage.BackButtonContent), RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNull}, FallbackValue=False}" />
<ContentPresenter
Content="{Binding CurrentPage?.(NavigationPage.BackButtonContent), RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}"
IsVisible="{Binding CurrentPage?.(NavigationPage.BackButtonContent), RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}, FallbackValue=False}"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Panel>
</Button>
<ContentPresenter
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
</Border>
</Panel>
Name="PART_NavBarSpacer"
Height="{TemplateBinding EffectiveBarHeight}"
IsVisible="False"
DockPanel.Dock="Top" />
<ContentPresenter
Name="PART_BottomCommandBar"
DockPanel.Dock="Bottom"
Background="{TemplateBinding Background}"
Content="{Binding CurrentPage.(NavigationPage.BottomCommandBar), RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}" />
<Panel
Name="PART_ContentHost"
Background="{TemplateBinding Background}"
ClipToBounds="True">
<ContentPresenter Name="PART_PageBackPresenter" />
<ContentPresenter Name="PART_PagePresenter" />
</Panel>
</DockPanel>
<!-- Bottom command bar -->
<Border
Name="PART_NavigationBar"
VerticalAlignment="Top"
MinHeight="{TemplateBinding EffectiveBarHeight}"
Padding="{DynamicResource NavigationPageBarPadding}"
Background="{DynamicResource NavigationPageBarBackground}"
BorderBrush="{DynamicResource NavigationPageBarBorderBrush}"
BorderThickness="{DynamicResource NavigationPageBarBorderThickness}">
<Grid ColumnDefinitions="Auto,*,Auto">
<Button
Name="PART_BackButton"
Grid.Column="0"
Classes="Tertiary"
Height="{TemplateBinding BarHeight}"
Width="{TemplateBinding BarHeight}"
Padding="8"
IsVisible="{TemplateBinding IsBackButtonEffectivelyVisible}"
Theme="{StaticResource BorderlessButton}">
<Panel Background="Transparent">
<PathIcon
Name="PART_BackButtonDefaultIcon"
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource NavigationPageBackButtonGlyph}" />
<ContentPresenter
Name="PART_BackButtonContentPresenter"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Panel>
</Button>
<ContentPresenter
Name="PART_Header"
Grid.Column="1"
FontWeight="SemiBold"
Content="{Binding CurrentPage?.Header, RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}"
ContentTemplate="{Binding CurrentPage?.HeaderTemplate, RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}"
VerticalAlignment="Center"
Margin="12,0" />
<ContentPresenter
Name="PART_TopCommandBar"
Grid.Column="2"
HorizontalAlignment="Right"
Content="{Binding CurrentPage?.(NavigationPage.TopCommandBar), RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}" />
</Grid>
</Border>
<Border
Name="PART_NavBarShadow"
ZIndex="1"
VerticalAlignment="Top"
IsVisible="False"
Height="4"
IsHitTestVisible="False">
<Border.Background>
<LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%">
<GradientStop Color="#0C000000" Offset="0" />
<GradientStop Color="#00000000" Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<ContentPresenter
Name="PART_BottomCommandBar"
Grid.Row="2" />
</Grid>
Name="PART_ModalBackPresenter"
ZIndex="99"
IsVisible="False"
Background="{TemplateBinding Background}" />
<ContentPresenter
Name="PART_ModalPresenter"
ZIndex="100"
IsVisible="False"
Background="{TemplateBinding Background}" />
</Panel>
</ControlTemplate>
</Setter>
<!-- Navigation bar is inset (content flows under the bar) -->
<Style Selector="^:nav-bar-inset /template/ Border#PART_NavigationBar">
<Setter Property="BorderThickness" Value="0" />
<Style Selector="^ /template/ Border#PART_NavigationBar">
<Setter Property="Background" Value="{DynamicResource NavigationBarBackground}" />
</Style>
<!-- Compact navigation bar -->
<Style Selector="^:nav-bar-compact /template/ Border#PART_NavigationBar">
<Setter Property="MinHeight" Value="0" />
<Style Selector="^:nav-bar-inset /template/ Border#PART_NavBarSpacer">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:nav-bar-compact /template/ ContentPresenter#PART_TopCommandBar CommandBar">
<Setter Property="DefaultLabelPosition" Value="Collapsed" />
</Style>
<Style Selector="^.Large">
<Setter Property="BarHeight" Value="{DynamicResource NavigationPageBarLargeMinHeight}" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -154,10 +154,6 @@
<Style Selector="^.Danger">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarDangerForeground}" />
</Style>
<!-- Error style is obsolete, use Danger instead -->
<Style Selector="^.Error">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarErrorForeground}" />
</Style>
<Style Selector="^:horizontal">
<Setter Property="MinWidth" Value="200" />
@@ -385,10 +381,6 @@
<Style Selector="^.Danger">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarDangerForeground}" />
</Style>
<!-- Error style is obsolete, use Danger instead -->
<Style Selector="^.Error">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarErrorForeground}" />
</Style>
<Style Selector="^:indeterminate /template/ Arc#Indicator">
<Setter Property="Opacity" Value="0" />
</Style>

View File

@@ -493,250 +493,4 @@
<Setter Property="IsVisible" Value="True" />
</Style>
</ControlTheme>
<!-- Obsolete after Avalonia 11.3.7 -->
<ControlTheme x:Key="VerticalSplitView" TargetType="SplitView">
<Setter Property="OpenPaneLength" Value="{DynamicResource SplitViewOpenPaneThemeLength}" />
<Setter Property="CompactPaneLength" Value="{DynamicResource SplitViewCompactPaneThemeLength}" />
<Setter Property="PaneBackground" Value="{DynamicResource SplitViewPaneBackground}" />
<Style Selector="^:left">
<Setter Property="Template">
<ControlTemplate TargetType="SplitView">
<Grid Name="Container" Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<!-- why is this throwing a binding error? -->
<RowDefinition Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneColumnGridLength}" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Panel
Name="PART_PaneRoot"
VerticalAlignment="Top"
Background="{TemplateBinding PaneBackground}"
ClipToBounds="True"
ZIndex="100">
<ContentPresenter
Name="PART_PanePresenter"
Content="{TemplateBinding Pane}"
ContentTemplate="{TemplateBinding PaneTemplate}" />
<Rectangle
Name="HCPaneBorder"
Height="1"
VerticalAlignment="Bottom"
Fill="{DynamicResource SplitViewSeparatorBackground}" />
</Panel>
<Panel Name="ContentRoot">
<ContentPresenter
Name="PART_ContentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
<Rectangle
Name="LightDismissLayer"
Fill="Transparent"
IsVisible="False" />
</Panel>
</Grid>
</ControlTemplate>
</Setter>
<Style Selector="^:overlay">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.Row" Value="0" />
</Style>
<Style Selector="^ /template/ Panel#ContentRoot">
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Grid.RowSpan" Value="2" />
</Style>
</Style>
<Style Selector="^:compactinline">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style>
<Style Selector="^ /template/ Panel#ContentRoot">
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Grid.RowSpan" Value="1" />
</Style>
</Style>
<Style Selector="^:compactoverlay">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<!-- RowSpan should be 2 -->
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style>
<Style Selector="^ /template/ Panel#ContentRoot">
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Grid.RowSpan" Value="1" />
</Style>
</Style>
<Style Selector="^:inline">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style>
<Style Selector="^ /template/ Panel#ContentRoot">
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Grid.RowSpan" Value="1" />
</Style>
</Style>
</Style>
<Style Selector="^:right">
<Setter Property="Template">
<ControlTemplate>
<Grid Name="Container" Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneColumnGridLength}" />
</Grid.RowDefinitions>
<Panel
Name="PART_PaneRoot"
VerticalAlignment="Bottom"
Background="{TemplateBinding PaneBackground}"
ClipToBounds="True"
ZIndex="100">
<ContentPresenter
Name="PART_PanePresenter"
Content="{TemplateBinding Pane}"
ContentTemplate="{TemplateBinding PaneTemplate}" />
<Rectangle
Name="HCPaneBorder"
Height="1"
VerticalAlignment="Top"
Fill="{DynamicResource SplitViewSeparatorBackground}" />
</Panel>
<Panel Name="ContentRoot">
<ContentPresenter
Name="PART_ContentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
<Rectangle Name="LightDismissLayer" IsVisible="False" />
</Panel>
</Grid>
</ControlTemplate>
</Setter>
<Style Selector="^:overlay">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
<Setter Property="Grid.RowSpan" Value="2" />
<Setter Property="Grid.Row" Value="1" />
</Style>
<Style Selector="^ /template/ Panel#ContentRoot">
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Grid.RowSpan" Value="2" />
</Style>
</Style>
<Style Selector="^:compactinline">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style>
<Style Selector="^ /template/ Panel#ContentRoot">
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Grid.RowSpan" Value="1" />
</Style>
</Style>
<Style Selector="^:compactoverlay">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.RowSpan" Value="2" />
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style>
<Style Selector="^ /template/ Panel#ContentRoot">
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Grid.RowSpan" Value="1" />
</Style>
</Style>
<Style Selector="^:inline">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style>
<Style Selector="^ /template/ Panel#ContentRoot">
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Grid.RowSpan" Value="1" />
</Style>
</Style>
</Style>
<Style Selector="^:open">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Transitions">
<Transitions>
<DoubleTransition
Easing="{StaticResource SplitViewPaneAnimationEasing}"
Property="Height"
Duration="{StaticResource SplitViewPaneAnimationOpenDuration}" />
</Transitions>
</Setter>
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OpenPaneLength}" />
</Style>
<Style Selector="^ /template/ Rectangle#LightDismissLayer">
<Setter Property="Transitions">
<Transitions>
<DoubleTransition
Easing="{StaticResource SplitViewPaneAnimationEasing}"
Property="Opacity"
Duration="{StaticResource SplitViewPaneAnimationOpenDuration}" />
</Transitions>
</Setter>
<Setter Property="Opacity" Value="1.0" />
</Style>
</Style>
<Style Selector="^:closed">
<Style Selector="^ /template/ Panel#PART_PaneRoot">
<Setter Property="Transitions">
<Transitions>
<DoubleTransition
Easing="{StaticResource SplitViewPaneAnimationEasing}"
Property="Height"
Duration="{StaticResource SplitViewPaneAnimationCloseDuration}" />
</Transitions>
</Setter>
<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
</Style>
<Style Selector="^ /template/ Rectangle#LightDismissLayer">
<Setter Property="Transitions">
<Transitions>
<DoubleTransition
Easing="{StaticResource SplitViewPaneAnimationEasing}"
Property="Opacity"
Duration="{StaticResource SplitViewPaneAnimationCloseDuration}" />
</Transitions>
</Setter>
<Setter Property="Opacity" Value="0.0" />
</Style>
</Style>
<Style Selector="^:lightDismiss /template/ Rectangle#LightDismissLayer">
<Setter Property="Fill" Value="{DynamicResource SplitViewMaskBrush}" />
</Style>
<Style Selector="^:overlay:open /template/ Rectangle#LightDismissLayer">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:compactoverlay:open /template/ Rectangle#LightDismissLayer">
<Setter Property="IsVisible" Value="True" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -11,8 +11,7 @@
<TabControl
Name="PART_TabControl"
Background="{TemplateBinding Background}"
Theme="{StaticResource LineTabControl}"
ItemsSource="{TemplateBinding Pages}" />
Theme="{StaticResource LineTabControl}" />
</ControlTemplate>
</Setter>
</ControlTheme>
@@ -22,8 +21,7 @@
<TabControl
Name="PART_TabControl"
Background="{TemplateBinding Background}"
Theme="{StaticResource CardTabControl}"
ItemsSource="{TemplateBinding Pages}" />
Theme="{StaticResource CardTabControl}" />
</ControlTemplate>
</Setter>
</ControlTheme>
@@ -33,8 +31,7 @@
<TabControl
Name="PART_TabControl"
Background="{TemplateBinding Background}"
Theme="{StaticResource ButtonTabControl}"
ItemsSource="{TemplateBinding Pages}" />
Theme="{StaticResource ButtonTabControl}" />
</ControlTemplate>
</Setter>
</ControlTheme>

View File

@@ -81,6 +81,7 @@
Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerLeftContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
<ScrollViewer
Name="PART_ScrollViewer"
Grid.Column="1"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
@@ -319,6 +320,7 @@
Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerLeftContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
<ScrollViewer
Name="PART_ScrollViewer"
Grid.Column="1"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
@@ -544,6 +546,7 @@
Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerLeftContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
<ScrollViewer
Name="PART_ScrollViewer"
Grid.Column="1"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"

View File

@@ -610,6 +610,9 @@
<StreamGeometry x:Key="SemiIconMaximize">
M14 3.5c0-.83.67-1.5 1.5-1.5h3A3.5 3.5 0 0 1 22 5.5v3a1.5 1.5 0 0 1-3 0v-3a.5.5 0 0 0-.5-.5h-3A1.5 1.5 0 0 1 14 3.5Zm-12 2A3.5 3.5 0 0 1 5.5 2h3a1.5 1.5 0 1 1 0 3h-3a.5.5 0 0 0-.5.5v3a1.5 1.5 0 1 1-3 0v-3ZM3.5 14c.83 0 1.5.67 1.5 1.5v3c0 .28.22.5.5.5h3a1.5 1.5 0 0 1 0 3h-3A3.5 3.5 0 0 1 2 18.5v-3c0-.83.67-1.5 1.5-1.5Zm17 0c.83 0 1.5.67 1.5 1.5v3a3.5 3.5 0 0 1-3.5 3.5h-3a1.5 1.5 0 0 1 0-3h3a.5.5 0 0 0 .5-.5v-3c0-.83.67-1.5 1.5-1.5Z
</StreamGeometry>
<StreamGeometry x:Key="SemiIconMaximize2">
M5 5.5A.5.5 0 015.5 5h13a.5.5 0 01.5.5v13a.5.5 0 01-.5.5H5.5A.5.5 0 015 18.5V5.5Zm-3 0v13A3.5 3.5 0 005.5 22h13A3.5 3.5 0 0022 18.5V5A3.5 3.5 0 0018.5 2H5.5A3.5 3.5 0 002 5.5Z
</StreamGeometry>
<StreamGeometry x:Key="SemiIconMember">
M.83 7.66c-.24-.77.67-1.37 1.28-.85l1.86 1.6a3 3 0 0 0 4.68-1.04L11.1 2a1 1 0 0 1 1.82 0l2.44 5.37a3 3 0 0 0 4.68 1.03l1.86-1.59c.6-.52 1.52.08 1.28.85L19.44 19.6a2 2 0 0 1-1.91 1.4H6.47a2 2 0 0 1-1.9-1.4L.82 7.66Z
</StreamGeometry>
@@ -750,6 +753,9 @@
M4.5 2C3.67 2 3 2.67 3 3.5v17a1.5 1.5 0 0 0 3 0v-17C6 2.67 5.33 2 4.5 2Z
M8 11.21l 11.38-8.94a1 1 0 0 1 1.62.79v17.88a1 1 0 0 1-1.62.79L8 12.79a1 1 0 0 1 0-1.58Z
</StreamGeometry>
<StreamGeometry x:Key="SemiIconRestore">
M3 9A2 2 0 015 7H15a2 2 0 012 2V19a2 2 0 01-2 2H5A2 2 0 013 19V9Zm3 1v8h8V10H6ZM7 4c0-1.1.9-2 2-2h11a2 2 0 012 2v11a2 2 0 01-2 2h-1V5H7V4Z
</StreamGeometry>
<StreamGeometry x:Key="SemiIconRotate">
M14.2 2.2A1 1 0 0 0 12.8.8l-2.5 2.5a1 1 0 0 0 0 1.4l2.5 2.5a1 1 0 1 0 1.4-1.4l-.79-.8H16a5 5 0 0 1 5 5v2a1 1 0 1 0 2 0v-2a7 7 0 0 0-7-7h-2.59l.8-.8Z
M3 10c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V10Z

View File

@@ -325,6 +325,9 @@
<StreamGeometry x:Key="SemiIconMarginStroked">
M4 2a2 2 0 0 0-2 2v16c0 1.1.9 2 2 2h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H4Zm9 2h7v7h-2a1 1 0 1 0 0 2h2v7h-7v-2a1 1 0 1 0-2 0v2H4v-7h2a1 1 0 1 0 0-2H4V4h7v2a1 1 0 1 0 2 0V4ZM9 8a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1H9Zm1 6v-4h4v4h-4Z
</StreamGeometry>
<StreamGeometry x:Key="SemiIconMaximize2Stroked">
M4 4H21V20H4V4ZM2 3V21a1 1 0 001 1H22a1 1 0 001-1V3A1 1 0 0022 2H3A1 1 0 002 3Z
</StreamGeometry>
<StreamGeometry x:Key="SemiIconMicrophoneStroked">
M16 21a1 1 0 1 1 0 2H8a1 1 0 1 1 0-2h8Zm3-10.5a1 1 0 0 1 1 1 8 8 1 1 1-16 0 1 1 0 1 1 2 0 6 6 0 0 0 12 0 1 1 0 0 1 1-1ZM12 1a4.5 4.5 0 0 1 4.5 4.5v6a4.5 4.5 1 1 1-9 0v-6A4.5 4.5 0 0 1 12 1Zm0 2a2.5 2.5 0 0 0-2.5 2.5v6a2.5 2.5 0 0 0 5 0v-6A2.5 2.5 0 0 0 12 3Z
</StreamGeometry>
@@ -408,6 +411,9 @@
<StreamGeometry x:Key="SemiIconReplyStroked">
m3.88 12 5.68 5.98V16.5a3 3 0 0 1 3.01-3c2.3 0 4.44.06 6.26.85.45.2.86.42 1.24.69a7.63 7.63 0 0 0-1.64-2.9c-1.3-1.43-3.27-2.43-6-2.6A3.05 3.05 0 0 1 9.56 6.5v-.48L3.88 12Zm16.6 6.25c-1.81-2.53-3.94-2.73-7.92-2.75a1 1 0 0 0-1 1v4a1 1 0 0 1-1.71.69l-8.07-8.5a1 1 0 0 1 0-1.38l8.07-8.5a1 1 0 0 1 1.71.7v3c0 .55.45.99 1 1.02 6.22.4 9.8 4.6 9.94 10.14a13.2 13.2 0 0 1-.03.77c-.04.35-.1.8-.2 1.18-.1.35-.2.64-.33.7-.13.05-.28-.02-.43-.33a14.18 14.18 0 0 0-1.03-1.74Z
</StreamGeometry>
<StreamGeometry x:Key="SemiIconRestoreStroked">
M22 16a2 2 0 01-2 2V4H6c0-1.1.9-2 2-2h12a2 2 0 012 2v12ZM2 8c0-1.1.9-2 2-2h12a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V8ZM4 8V20H16V8H4Z
</StreamGeometry>
<StreamGeometry x:Key="SemiIconRingChartStroked">
M20.95 13A9 9 0 1 1 11 3.05V7.1a5 5 0 1 0 5.9 5.9h4.05Zm0-2H16.9A5 5 0 0 0 13 7.1V3.05A9 9 0 0 1 20.95 11ZM23 12a11 11 0 1 1-22 0 11 11 0 0 1 22 0Zm-8 0a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z
</StreamGeometry>

View File

@@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.0-rc2</Version>
<PackageReleaseNotes>Update to Semi.Avalonia 12.0.0-rc2</PackageReleaseNotes>
<Version>12.0.0</Version>
<PackageReleaseNotes>Update to Semi.Avalonia 12.0.0</PackageReleaseNotes>
<Title>Semi.Avalonia</Title>
</PropertyGroup>

View File

@@ -25,7 +25,4 @@
<StaticResource x:Key="CheckBoxCardPressedBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="CheckBoxCardCheckedPointeroverBorderBrush" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="CheckBoxCardCheckedPressedBorderBrush" ResourceKey="SemiColorPrimaryActive" />
<!-- Obsolete -->
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorWhite" />
</ResourceDictionary>

View File

@@ -4,10 +4,6 @@
<StaticResource x:Key="DrawerPageForeground" ResourceKey="SemiColorText0" />
<!-- Top bar -->
<StaticResource x:Key="DrawerPageTopBarBackground" ResourceKey="SemiColorBackground1" />
<StaticResource x:Key="DrawerPageTopBarBorderBrush" ResourceKey="SemiColorBorder" />
<!-- Drawer pane -->
<StaticResource x:Key="DrawerPageDrawerBackground" ResourceKey="SemiColorNavBackground" />
<!-- Pane button -->
<SolidColorBrush x:Key="DrawerPagePaneButtonBackground" Color="Transparent" />
<StaticResource x:Key="DrawerPagePaneButtonForeground" ResourceKey="SemiColorText0" />
</ResourceDictionary>

View File

@@ -102,12 +102,4 @@
<StaticResource x:Key="LabelTagColorfulGradientGhostBorderBrush" ResourceKey="SemiColorAIGeneral" />
<StaticResource x:Key="LabelTagColorfulGradientSolidForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="LabelTagColorfulGradientSolidBackground" ResourceKey="SemiColorAIGeneral" />
<!-- Obsolete -->
<StaticResource x:Key="LabelTagLightWhiteForeground" ResourceKey="LabelTagSolidWhiteForeground" />
<StaticResource x:Key="LabelTagLightWhiteBackground" ResourceKey="LabelTagSolidWhiteBackground" />
<StaticResource x:Key="LabelTagLightWhiteBorderBrush" ResourceKey="LabelTagSolidWhiteBorderBrush" />
<StaticResource x:Key="LabelTagGhostWhiteForeground" ResourceKey="LabelTagSolidWhiteForeground" />
<StaticResource x:Key="LabelTagGhostWhiteBackground" ResourceKey="LabelTagSolidWhiteBackground" />
<StaticResource x:Key="LabelTagGhostWhiteBorderBrush" ResourceKey="LabelTagSolidWhiteBorderBrush" />
</ResourceDictionary>

View File

@@ -1,14 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- NavigationPage -->
<StaticResource x:Key="NavigationPageBackground" ResourceKey="SemiColorBackground0" />
<StaticResource x:Key="NavigationPageForeground" ResourceKey="SemiColorText0" />
<!-- Navigation bar -->
<StaticResource x:Key="NavigationPageBarBackground" ResourceKey="SemiColorBackground1" />
<StaticResource x:Key="NavigationPageBarForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="NavigationPageBarBorderBrush" ResourceKey="SemiColorBorder" />
<!-- Back button -->
<SolidColorBrush x:Key="NavigationPageBackButtonBackground" Color="Transparent" />
<StaticResource x:Key="NavigationPageBackButtonForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="NavigationPageBackButtonPointeroverBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="NavigationPageBackButtonPressedBackground" ResourceKey="SemiColorFill1" />
</ResourceDictionary>

View File

@@ -9,6 +9,4 @@
<StaticResource x:Key="ProgressBarSuccessForeground" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="ProgressBarWarningForeground" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ProgressBarDangerForeground" ResourceKey="SemiColorDanger" />
<!-- Error style is obsolete, use Danger instead -->
<StaticResource x:Key="ProgressBarErrorForeground" ResourceKey="SemiColorDanger" />
</ResourceDictionary>

View File

@@ -25,7 +25,4 @@
<StaticResource x:Key="CheckBoxCardPressedBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="CheckBoxCardCheckedPointeroverBorderBrush" ResourceKey="SemiColorButtonText" />
<StaticResource x:Key="CheckBoxCardCheckedPressedBorderBrush" ResourceKey="SemiColorHighlight" />
<!-- Obsolete -->
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorHighlightText" />
</ResourceDictionary>

View File

@@ -4,10 +4,6 @@
<StaticResource x:Key="DrawerPageForeground" ResourceKey="SemiColorWindowText" />
<!-- Top bar -->
<StaticResource x:Key="DrawerPageTopBarBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="DrawerPageTopBarBorderBrush" ResourceKey="SemiColorWindowText" />
<!-- Drawer pane -->
<StaticResource x:Key="DrawerPageDrawerBackground" ResourceKey="SemiColorWindow" />
<!-- Pane button -->
<SolidColorBrush x:Key="DrawerPagePaneButtonBackground" Color="Transparent" />
<StaticResource x:Key="DrawerPagePaneButtonForeground" ResourceKey="SemiColorWindowText" />
</ResourceDictionary>

View File

@@ -1,14 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- NavigationPage -->
<StaticResource x:Key="NavigationPageBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="NavigationPageForeground" ResourceKey="SemiColorWindowText" />
<!-- Navigation bar -->
<StaticResource x:Key="NavigationPageBarBackground" ResourceKey="SemiColorWindow" />
<StaticResource x:Key="NavigationPageBarForeground" ResourceKey="SemiColorWindowText" />
<StaticResource x:Key="NavigationPageBarBorderBrush" ResourceKey="SemiColorWindowText" />
<!-- Back button -->
<SolidColorBrush x:Key="NavigationPageBackButtonBackground" Color="Transparent" />
<StaticResource x:Key="NavigationPageBackButtonForeground" ResourceKey="SemiColorWindowText" />
<StaticResource x:Key="NavigationPageBackButtonPointeroverBackground" ResourceKey="SemiColorHighlight" />
<StaticResource x:Key="NavigationPageBackButtonPressedBackground" ResourceKey="SemiColorHighlightText" />
</ResourceDictionary>

View File

@@ -25,7 +25,4 @@
<StaticResource x:Key="CheckBoxCardPressedBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="CheckBoxCardCheckedPointeroverBorderBrush" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="CheckBoxCardCheckedPressedBorderBrush" ResourceKey="SemiColorPrimaryActive" />
<!-- Obsolete -->
<StaticResource x:Key="CheckBoxGlyphDisabledFill" ResourceKey="SemiColorWhite" />
</ResourceDictionary>

View File

@@ -4,10 +4,6 @@
<StaticResource x:Key="DrawerPageForeground" ResourceKey="SemiColorText0" />
<!-- Top bar -->
<StaticResource x:Key="DrawerPageTopBarBackground" ResourceKey="SemiColorBackground1" />
<StaticResource x:Key="DrawerPageTopBarBorderBrush" ResourceKey="SemiColorBorder" />
<!-- Drawer pane -->
<StaticResource x:Key="DrawerPageDrawerBackground" ResourceKey="SemiColorNavBackground" />
<!-- Pane button -->
<SolidColorBrush x:Key="DrawerPagePaneButtonBackground" Color="Transparent" />
<StaticResource x:Key="DrawerPagePaneButtonForeground" ResourceKey="SemiColorText0" />
</ResourceDictionary>

View File

@@ -102,12 +102,4 @@
<StaticResource x:Key="LabelTagColorfulGradientGhostBorderBrush" ResourceKey="SemiColorAIGeneral" />
<StaticResource x:Key="LabelTagColorfulGradientSolidForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="LabelTagColorfulGradientSolidBackground" ResourceKey="SemiColorAIGeneral" />
<!-- Obsolete -->
<StaticResource x:Key="LabelTagLightWhiteForeground" ResourceKey="LabelTagSolidWhiteForeground" />
<StaticResource x:Key="LabelTagLightWhiteBackground" ResourceKey="LabelTagSolidWhiteBackground" />
<StaticResource x:Key="LabelTagLightWhiteBorderBrush" ResourceKey="LabelTagSolidWhiteBorderBrush" />
<StaticResource x:Key="LabelTagGhostWhiteForeground" ResourceKey="LabelTagSolidWhiteForeground" />
<StaticResource x:Key="LabelTagGhostWhiteBackground" ResourceKey="LabelTagSolidWhiteBackground" />
<StaticResource x:Key="LabelTagGhostWhiteBorderBrush" ResourceKey="LabelTagSolidWhiteBorderBrush" />
</ResourceDictionary>

View File

@@ -1,14 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- NavigationPage -->
<StaticResource x:Key="NavigationPageBackground" ResourceKey="SemiColorBackground0" />
<StaticResource x:Key="NavigationPageForeground" ResourceKey="SemiColorText0" />
<!-- Navigation bar -->
<StaticResource x:Key="NavigationPageBarBackground" ResourceKey="SemiColorBackground1" />
<StaticResource x:Key="NavigationPageBarForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="NavigationPageBarBorderBrush" ResourceKey="SemiColorBorder" />
<!-- Back button -->
<SolidColorBrush x:Key="NavigationPageBackButtonBackground" Color="Transparent" />
<StaticResource x:Key="NavigationPageBackButtonForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="NavigationPageBackButtonPointeroverBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="NavigationPageBackButtonPressedBackground" ResourceKey="SemiColorFill1" />
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -9,6 +9,4 @@
<StaticResource x:Key="ProgressBarSuccessForeground" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="ProgressBarWarningForeground" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ProgressBarDangerForeground" ResourceKey="SemiColorDanger" />
<!-- Error style is obsolete, use Danger instead -->
<StaticResource x:Key="ProgressBarErrorForeground" ResourceKey="SemiColorDanger" />
</ResourceDictionary>

View File

@@ -1,15 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DrawerPage top bar -->
<x:Double x:Key="DrawerPageTopBarMinHeight">48</x:Double>
<Thickness x:Key="DrawerPageTopBarPadding">4 0</Thickness>
<Thickness x:Key="DrawerPageTopBarBorderThickness">0 0 0 1</Thickness>
<!-- DrawerPage pane/drawer -->
<x:Double x:Key="DrawerPageDrawerLength">280</x:Double>
<x:Double x:Key="DrawerPageCompactDrawerLength">56</x:Double>
<x:Double x:Key="DrawerPageTopBarMinHeight">32</x:Double>
<!-- DrawerPage pane button -->
<x:Double x:Key="DrawerPagePaneButtonSize">32</x:Double>
<Thickness x:Key="DrawerPagePaneButtonMargin">8 0</Thickness>
<StaticResource x:Key="DrawerPageMenuGlyph" ResourceKey="SemiIconMenu" />
</ResourceDictionary>

View File

@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- NavigationPage -->
<x:Double x:Key="NavigationPageBarMinHeight">48</x:Double>
<x:Double x:Key="NavigationPageBarMinHeight">32</x:Double>
<x:Double x:Key="NavigationPageBarLargeMinHeight">48</x:Double>
<Thickness x:Key="NavigationPageBarPadding">4 0</Thickness>
<Thickness x:Key="NavigationPageBarBorderThickness">0 0 0 1</Thickness>
<StaticResource x:Key="NavigationPageBackButtonGlyph" ResourceKey="SemiIconChevronLeft" />

View File

@@ -3,13 +3,8 @@
<StaticResource x:Key="WindowMinimizeGlyph" ResourceKey="SemiIconMinus" />
<StaticResource x:Key="WindowExpandGlyph" ResourceKey="SemiIconExpand" />
<StaticResource x:Key="WindowCollapseGlyph" ResourceKey="SemiIconShrink" />
<StreamGeometry x:Key="WindowMaximizeGlyph">
M5 5.5A.5.5 0 015.5 5h13a.5.5 0 01.5.5v13a.5.5 0 01-.5.5H5.5A.5.5 0 015 18.5V5.5Zm-3 0v13A3.5 3.5 0 005.5 22h13A3.5 3.5 0 0022 18.5V5A3.5 3.5 0 0018.5 2H5.5A3.5 3.5 0 002 5.5Z
</StreamGeometry>
<StreamGeometry x:Key="WindowRestoreGlyph">
M3 9A2 2 0 015 7H15a2 2 0 012 2V19a2 2 0 01-2 2H5A2 2 0 013 19V9Zm3 1v8h8V10H6ZM7 4c0-1.1.9-2 2-2h11a2 2 0 012 2v11a2 2 0 01-2 2h-1V5H7V4Z
</StreamGeometry>
<StaticResource x:Key="WindowMaximizeGlyph" ResourceKey="SemiIconMaximize2" />
<StaticResource x:Key="WindowRestoreGlyph" ResourceKey="SemiIconRestore" />
<StaticResource x:Key="CaptionButtonCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<StaticResource x:Key="CaptionButtonWidth" ResourceKey="SemiSpacingExtraLoose" />

View File

@@ -584,13 +584,4 @@
<!-- Shadow -->
<BoxShadows x:Key="SemiColorShadow">0 0 #0A000000</BoxShadows>
<BoxShadows x:Key="SemiShadowElevated">inset 0 0 0 1 #1AFFFFFF, 0 4 14 #40000000</BoxShadows>
<!-- Obsolete -->
<StaticResource x:Key="SemiColorPrimaryPressed" ResourceKey="SemiColorPrimaryActive" />
<StaticResource x:Key="SemiColorSecondaryPressed" ResourceKey="SemiColorSecondaryActive" />
<StaticResource x:Key="SemiColorTertiaryPressed" ResourceKey="SemiColorTertiaryActive" />
<StaticResource x:Key="SemiColorInformationPressed" ResourceKey="SemiColorInformationActive" />
<StaticResource x:Key="SemiColorSuccessPressed" ResourceKey="SemiColorSuccessActive" />
<StaticResource x:Key="SemiColorWarningPressed" ResourceKey="SemiColorWarningActive" />
<StaticResource x:Key="SemiColorDangerPressed" ResourceKey="SemiColorDangerActive" />
</ResourceDictionary>

View File

@@ -584,13 +584,4 @@
<!-- Shadow -->
<BoxShadows x:Key="SemiColorShadow">0 0 #0A000000</BoxShadows>
<BoxShadows x:Key="SemiShadowElevated">0 0 1 #4A000000, 0 4 14 #1A000000</BoxShadows>
<!-- Obsolete -->
<StaticResource x:Key="SemiColorPrimaryPressed" ResourceKey="SemiColorPrimaryActive" />
<StaticResource x:Key="SemiColorSecondaryPressed" ResourceKey="SemiColorSecondaryActive" />
<StaticResource x:Key="SemiColorTertiaryPressed" ResourceKey="SemiColorTertiaryActive" />
<StaticResource x:Key="SemiColorInformationPressed" ResourceKey="SemiColorInformationActive" />
<StaticResource x:Key="SemiColorSuccessPressed" ResourceKey="SemiColorSuccessActive" />
<StaticResource x:Key="SemiColorWarningPressed" ResourceKey="SemiColorWarningActive" />
<StaticResource x:Key="SemiColorDangerPressed" ResourceKey="SemiColorDangerActive" />
</ResourceDictionary>