From 8142dd48cd98e7b67c5d62d7ef94a0c0a0014996 Mon Sep 17 00:00:00 2001 From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com> Date: Sun, 24 Mar 2024 21:00:20 +0800 Subject: [PATCH 1/3] feat: ComboBox BackgroundSizing. --- .../Pages/ComboBoxDemo.axaml | 95 +++++++------------ .../Pages/ComboBoxDemo.axaml.cs | 10 +- src/Semi.Avalonia/Controls/ComboBox.axaml | 9 +- 3 files changed, 45 insertions(+), 69 deletions(-) diff --git a/demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml index 488a8ff..3bf4425 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml @@ -4,71 +4,40 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - d:DesignHeight="450" + xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages" + d:DesignHeight="800" d:DesignWidth="800" mc:Ignorable="d"> + + + - - Ding - Otter - Husky - Mr. 17 - Cass - - - Ding - Otter - Husky - Mr. 17 - Cass - - - Ding - Otter - Husky - Mr. 17 - Cass - - - Ding - Otter - Husky - Mr. 17 - Cass - - - Ding - Otter - Husky - Mr. 17 - Cass - - - Ding - Otter - Husky - Mr. 17 - Cass - - - Ding - Otter - Husky - Mr. 17 - Cass - - - Ding - Otter - Husky - Mr. 17 - Cass - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml.cs index 80b05bc..3c8cba2 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml.cs +++ b/demo/Semi.Avalonia.Demo/Pages/ComboBoxDemo.axaml.cs @@ -1,6 +1,6 @@ -using Avalonia; +using System.Collections.ObjectModel; using Avalonia.Controls; -using Avalonia.Markup.Xaml; +using CommunityToolkit.Mvvm.ComponentModel; namespace Semi.Avalonia.Demo.Pages; @@ -9,5 +9,11 @@ public partial class ComboBoxDemo : UserControl public ComboBoxDemo() { InitializeComponent(); + this.DataContext = new ComboBoxDemoViewModel(); } +} + +public class ComboBoxDemoViewModel : ObservableObject +{ + public ObservableCollection Items { get; set; } = ["Ding", "Otter", "Husky", "Mr.17", "Cass"]; } \ No newline at end of file diff --git a/src/Semi.Avalonia/Controls/ComboBox.axaml b/src/Semi.Avalonia/Controls/ComboBox.axaml index b59da08..b37c66e 100644 --- a/src/Semi.Avalonia/Controls/ComboBox.axaml +++ b/src/Semi.Avalonia/Controls/ComboBox.axaml @@ -32,6 +32,7 @@ + @@ -41,6 +42,7 @@ + @@ -49,9 +51,8 @@ x:Name="Background" Grid.Column="0" Grid.ColumnSpan="3" - MinWidth="{DynamicResource ComboBoxThemeMinWidth}" - MinHeight="{DynamicResource ComboBoxDefaultHeight}" Background="{TemplateBinding Background}" + BackgroundSizing="{TemplateBinding BackgroundSizing}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" /> @@ -147,10 +148,10 @@ - - From 8de7a1ae8c1b782bca8d162398bc4c660a9cdcad Mon Sep 17 00:00:00 2001 From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com> Date: Sun, 24 Mar 2024 21:56:46 +0800 Subject: [PATCH 2/3] fix: various issues of demos. --- .../Pages/AutoCompleteBoxDemo.axaml | 58 ++++++++----- .../Pages/NumericUpDownDemo.axaml | 81 +++++++++---------- .../Pages/SplitViewDemo.axaml | 2 + .../Pages/TextBoxDemo.axaml | 43 +++++++--- .../Pages/ToggleButtonDemo.axaml | 6 +- 5 files changed, 107 insertions(+), 83 deletions(-) diff --git a/demo/Semi.Avalonia.Demo/Pages/AutoCompleteBoxDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/AutoCompleteBoxDemo.axaml index 0e13eda..7fc2efb 100644 --- a/demo/Semi.Avalonia.Demo/Pages/AutoCompleteBoxDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/AutoCompleteBoxDemo.axaml @@ -26,29 +26,7 @@ - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo/Semi.Avalonia.Demo/Pages/NumericUpDownDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/NumericUpDownDemo.axaml index 64193c8..b249c23 100644 --- a/demo/Semi.Avalonia.Demo/Pages/NumericUpDownDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/NumericUpDownDemo.axaml @@ -4,62 +4,53 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - d:DesignHeight="450" + d:DesignHeight="800" d:DesignWidth="800" mc:Ignorable="d"> + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - - - - \ No newline at end of file diff --git a/demo/Semi.Avalonia.Demo/Pages/SplitViewDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/SplitViewDemo.axaml index 38a6db3..b63b60c 100644 --- a/demo/Semi.Avalonia.Demo/Pages/SplitViewDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/SplitViewDemo.axaml @@ -14,11 +14,13 @@ Orientation="Vertical" Spacing="4"> diff --git a/demo/Semi.Avalonia.Demo/Pages/TextBoxDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/TextBoxDemo.axaml index e5af706..e8dc197 100644 --- a/demo/Semi.Avalonia.Demo/Pages/TextBoxDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/TextBoxDemo.axaml @@ -5,23 +5,11 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:system="clr-namespace:System;assembly=netstandard" - d:DesignHeight="450" + d:DesignHeight="800" d:DesignWidth="800" mc:Ignorable="d"> - - - - - - - - - - - - @@ -54,6 +42,35 @@ InnerLeftContent="http://" InnerRightContent=".com" IsEnabled="False" /> + + + + + + + + + + + + diff --git a/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml index 60e6019..d349fef 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/ToggleButtonDemo.axaml @@ -17,7 +17,7 @@ Success Warning Danger - Danger + Disabled @@ -32,7 +32,7 @@ Classes="Danger" IsChecked="True" IsEnabled="False"> - Danger + Disabled @@ -79,7 +79,7 @@ IsChecked="{x:Null}" IsEnabled="False" IsThreeState="True"> - Danger + Disabled From 4e7681d4d4f1e660c32b9fa40affdea0fe871ef0 Mon Sep 17 00:00:00 2001 From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:35:13 +0800 Subject: [PATCH 3/3] feat: Small Classes and BackgroundSizing of DateTimePicker, ComboBox TextTrimming. --- .../Pages/DatePickerDemo.axaml | 11 +++++++++++ .../Pages/TimePickerDemo.axaml | 11 +++++++++++ src/Semi.Avalonia/Controls/ComboBox.axaml | 1 + src/Semi.Avalonia/Controls/DatePicker.axaml | 19 +++++++++++-------- .../Controls/DateTimePickerShared.axaml | 4 +++- src/Semi.Avalonia/Controls/TimePicker.axaml | 15 +++++++-------- 6 files changed, 44 insertions(+), 17 deletions(-) diff --git a/demo/Semi.Avalonia.Demo/Pages/DatePickerDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/DatePickerDemo.axaml index 3baefe4..cb6c0df 100644 --- a/demo/Semi.Avalonia.Demo/Pages/DatePickerDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/DatePickerDemo.axaml @@ -14,5 +14,16 @@ + + + + + + + + + + + diff --git a/demo/Semi.Avalonia.Demo/Pages/TimePickerDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/TimePickerDemo.axaml index c4b3216..c0f7ec8 100644 --- a/demo/Semi.Avalonia.Demo/Pages/TimePickerDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/TimePickerDemo.axaml @@ -15,5 +15,16 @@ + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Controls/ComboBox.axaml b/src/Semi.Avalonia/Controls/ComboBox.axaml index b37c66e..1a05313 100644 --- a/src/Semi.Avalonia/Controls/ComboBox.axaml +++ b/src/Semi.Avalonia/Controls/ComboBox.axaml @@ -62,6 +62,7 @@ Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + TextTrimming="CharacterEllipsis" Foreground="{TemplateBinding Foreground}" IsVisible="{TemplateBinding SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}" diff --git a/src/Semi.Avalonia/Controls/DatePicker.axaml b/src/Semi.Avalonia/Controls/DatePicker.axaml index 7a3210a..515bc26 100644 --- a/src/Semi.Avalonia/Controls/DatePicker.axaml +++ b/src/Semi.Avalonia/Controls/DatePicker.axaml @@ -132,6 +132,7 @@ + @@ -145,7 +146,7 @@ Grid.ColumnSpan="2" Width="298" MinWidth="298" - MinHeight="{DynamicResource DateTimePickerButtonDefaultHeight}" + MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}" @@ -165,7 +166,7 @@ ColumnDefinitions="78*,Auto,132*,Auto,78*"> @@ -255,10 +258,10 @@ - - diff --git a/src/Semi.Avalonia/Controls/DateTimePickerShared.axaml b/src/Semi.Avalonia/Controls/DateTimePickerShared.axaml index f18ddaf..6addc9c 100644 --- a/src/Semi.Avalonia/Controls/DateTimePickerShared.axaml +++ b/src/Semi.Avalonia/Controls/DateTimePickerShared.axaml @@ -6,7 +6,8 @@ - + + + @@ -149,7 +150,7 @@ Grid.ColumnSpan="2" Width="242" MinWidth="242" - MinHeight="{DynamicResource DateTimePickerButtonDefaultHeight}" + MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}" @@ -171,7 +172,7 @@ VerticalAlignment="Stretch"> @@ -194,7 +194,7 @@ VerticalAlignment="Stretch"> @@ -217,7 +216,7 @@ VerticalAlignment="Stretch"> - -