Merge branch 'main' into 11.2-test

This commit is contained in:
Dong Bin 2024-10-31 16:31:06 +08:00 committed by GitHub
commit 0d81c7d1bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 120 additions and 46 deletions

View File

@ -19,42 +19,74 @@
<ColorView ColorSpectrumShape="Box" /> <ColorView ColorSpectrumShape="Box" />
<ColorView Palette="{DynamicResource SemiColorPalette}" /> <ColorView Palette="{DynamicResource SemiColorPalette}" />
</StackPanel> </StackPanel>
<StackPanel <StackPanel VerticalAlignment="Top" Orientation="Horizontal">
VerticalAlignment="Top"
Orientation="Horizontal">
<ColorView <ColorView
Name="SimpleColorViewTest" Name="SimpleColorViewTest"
Theme="{StaticResource SimpleColorView}" HsvColor="hsv(120,11%,10%)"
IsAlphaVisible="True" IsAlphaVisible="True"
HsvColor="hsv(120,11%,10%)" /> Theme="{StaticResource SimpleColorView}" />
<StackPanel> <StackPanel>
<TextBlock Text="{Binding #SimpleColorViewTest.HsvColor}" /> <TextBlock Text="{Binding #SimpleColorViewTest.HsvColor}" />
<TextBlock Text="{Binding #SimpleColorViewTest.Color}" /> <TextBlock Text="{Binding #SimpleColorViewTest.Color}" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ColorPicker ColorSpectrumShape="Ring"> <ColorPicker Margin="8" ColorSpectrumShape="Ring">
<ColorPicker.Palette> <ColorPicker.Palette>
<controls:FlatHalfColorPalette /> <controls:FlatHalfColorPalette />
</ColorPicker.Palette> </ColorPicker.Palette>
</ColorPicker> </ColorPicker>
<ColorPicker ColorSpectrumShape="Box"> <ColorPicker Margin="8" ColorSpectrumShape="Box">
<ColorPicker.Palette> <ColorPicker.Palette>
<colorPicker:SemiColorLightPalette /> <colorPicker:SemiColorLightPalette />
</ColorPicker.Palette> </ColorPicker.Palette>
</ColorPicker> </ColorPicker>
<ColorPicker ColorSpectrumShape="Box" Theme="{DynamicResource HexColorPicker}"> <ColorPicker
Margin="8"
ColorSpectrumShape="Box"
Theme="{DynamicResource HexColorPicker}">
<ColorPicker.Palette> <ColorPicker.Palette>
<colorPicker:SemiColorLightPalette /> <colorPicker:SemiColorLightPalette />
</ColorPicker.Palette> </ColorPicker.Palette>
</ColorPicker> </ColorPicker>
</StackPanel> </StackPanel>
<StackPanel HorizontalAlignment="Left" >
<TextBlock Text="Use Style to customize button"></TextBlock>
<ColorPicker
Margin="8"
Width="32"
HsvColor="hsv(120,11%,10%)"
>
<ColorPicker.Content>
<Border
Margin="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
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>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ColorPicker Theme="{StaticResource SimpleColorPicker}" <ColorPicker
HsvColor="hsv(120,11%,10%)" /> Margin="8"
<ColorPicker Theme="{StaticResource HexSimpleColorPicker}" HsvColor="hsv(120,11%,10%)"
HsvColor="hsv(120,11%,10%)" /> Theme="{StaticResource SimpleColorPicker}" />
<ColorPicker
Margin="8"
HsvColor="hsv(120,11%,10%)"
Theme="{StaticResource HexSimpleColorPicker}" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>

View File

@ -13,17 +13,16 @@ public partial class PaletteDemo : UserControl
public PaletteDemo() public PaletteDemo()
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = new PaletteDemoViewModel();
} }
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e) protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
{ {
base.OnApplyTemplate(e); base.OnApplyTemplate(e);
PaletteDemoViewModel? vm = new PaletteDemoViewModel(); PaletteDemoViewModel? vm = this.DataContext as PaletteDemoViewModel;
await Dispatcher.UIThread.InvokeAsync(() => await Dispatcher.UIThread.InvokeAsync(() =>
{ {
vm.InitializeResources(); vm?.InitializeResources();
}); });
DataContext = vm;
} }
} }

View File

@ -51,7 +51,6 @@
<DropDownButton <DropDownButton
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
Padding="0,0,10,0"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
ClipToBounds="True" ClipToBounds="True"
@ -473,6 +472,10 @@
</DropDownButton> </DropDownButton>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^ /template/ DropDownButton">
<Setter Property="Padding" Value="0 0 10 0"></Setter>
</Style>
</ControlTheme> </ControlTheme>
<ControlTheme <ControlTheme
@ -523,7 +526,6 @@
<DropDownButton <DropDownButton
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
Padding="0,0,10,0"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
ClipToBounds="True" ClipToBounds="True"

View File

@ -406,10 +406,11 @@
Margin="4,0,0,0" Margin="4,0,0,0"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
IsVisible="{TemplateBinding IsPropertyNameVisible}" /> IsVisible="{TemplateBinding IsPropertyNameVisible}" />
<TextBlock <ContentControl
Name="PART_GroupKeyContentControl"
Margin="4,0,0,0" Margin="4,0,0,0"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
Text="{Binding Key}" /> Content="{Binding Key}" />
<TextBlock <TextBlock
Name="PART_ItemCountElement" Name="PART_ItemCountElement"
Margin="4,0,0,0" Margin="4,0,0,0"

View File

@ -1,5 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" <ResourceDictionary
x:Class="Semi.Avalonia.Locale.en_us" x:Class="Semi.Avalonia.Locale.en_us"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker --> <!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">day</x:String> <x:String x:Key="STRING_DATEPICKER_DAY_TEXT">day</x:String>

View File

@ -1,5 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" <ResourceDictionary
x:Class="Semi.Avalonia.Locale.ja_jp" x:Class="Semi.Avalonia.Locale.ja_jp"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker --> <!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">日</x:String> <x:String x:Key="STRING_DATEPICKER_DAY_TEXT">日</x:String>

View File

@ -1,5 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" <ResourceDictionary
x:Class="Semi.Avalonia.Locale.ru_ru" x:Class="Semi.Avalonia.Locale.ru_ru"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker --> <!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">день</x:String> <x:String x:Key="STRING_DATEPICKER_DAY_TEXT">день</x:String>

View File

@ -0,0 +1,27 @@
<ResourceDictionary
x:Class="Semi.Avalonia.Locale.uk_uk"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">день</x:String>
<x:String x:Key="STRING_DATEPICKER_MONTH_TEXT">місяць</x:String>
<x:String x:Key="STRING_DATEPICKER_YEAR_TEXT">рік</x:String>
<!-- TimePicker -->
<x:String x:Key="STRING_TIMEPICKER_HOUR_TEXT">години</x:String>
<x:String x:Key="STRING_TIMEPICKER_MINUTE_TEXT">хвилини</x:String>
<x:String x:Key="STRING_TIMEPICKER_SECOND_TEXT">секунди</x:String>
<!-- TextBox/SelectableTextBox flyout -->
<x:String x:Key="STRING_MENU_CUT">Вирізати</x:String>
<x:String x:Key="STRING_MENU_COPY">Копіювати</x:String>
<x:String x:Key="STRING_MENU_PASTE">Вставити</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Ім'я файлу</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Показати приховані папки</x:String>
<x:String x:Key="STRING_CHOOSER_DIALOG_OK">ОК</x:String>
<x:String x:Key="STRING_CHOOSER_DIALOG_CANCEL">Відмінити</x:String>
<x:String x:Key="STRING_CHOOSER_NAME_COLUMN">Ім'я</x:String>
<x:String x:Key="STRING_CHOOSER_DATEMODIFIED_COLUMN">Дата редагування</x:String>
<x:String x:Key="STRING_CHOOSER_TYPE_COLUMN">Тип</x:String>
<x:String x:Key="STRING_CHOOSER_SIZE_COLUMN">Розмір</x:String>
<x:String x:Key="STRING_CHOOSER_PROMPT_FILE_ALREADY_EXISTS">{0} уже існує. Ви бажаєте замінити його?</x:String>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
using Avalonia.Controls;
namespace Semi.Avalonia.Locale;
public class uk_uk : ResourceDictionary
{
}

View File

@ -1,5 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" <ResourceDictionary
x:Class="Semi.Avalonia.Locale.zh_cn" x:Class="Semi.Avalonia.Locale.zh_cn"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker --> <!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">日</x:String> <x:String x:Key="STRING_DATEPICKER_DAY_TEXT">日</x:String>

View File

@ -20,6 +20,7 @@ public class SemiTheme : Styles
{ new CultureInfo("zh-cn"), new zh_cn() }, { new CultureInfo("zh-cn"), new zh_cn() },
{ new CultureInfo("en-us"), new en_us() }, { new CultureInfo("en-us"), new en_us() },
{ new CultureInfo("ja-jp"), new ja_jp() }, { new CultureInfo("ja-jp"), new ja_jp() },
{ new CultureInfo("uk-uk"), new uk_uk() },
{ new CultureInfo("ru-ru"), new ru_ru() }, { new CultureInfo("ru-ru"), new ru_ru() },
}; };