feat: Add DropdownButton and SplitButton
This commit is contained in:
parent
8e584fe4eb
commit
d7574237ec
@ -27,5 +27,6 @@ class Program
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.With(new Win32PlatformOptions(){ UseCompositor = false})
|
||||
.LogToTrace();
|
||||
}
|
||||
|
@ -5,8 +5,12 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800" mc:Ignorable="d">
|
||||
<StackPanel Margin="20" HorizontalAlignment="Left" Spacing="20">
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel
|
||||
Margin="20"
|
||||
HorizontalAlignment="Left"
|
||||
Spacing="20">
|
||||
<TextBlock>Light (Default)</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
<Button Classes="Primary">Primary</Button>
|
||||
@ -23,7 +27,12 @@
|
||||
<Button Classes="Tertiary" Theme="{DynamicResource SolidButton}">Tertiary</Button>
|
||||
<Button Classes="Warning" Theme="{DynamicResource SolidButton}">Warning</Button>
|
||||
<Button Classes="Danger" Theme="{DynamicResource SolidButton}">Danger</Button>
|
||||
<Button Classes="Primary" IsEnabled="False" Theme="{DynamicResource SolidButton}">Danger</Button>
|
||||
<Button
|
||||
Classes="Primary"
|
||||
IsEnabled="False"
|
||||
Theme="{DynamicResource SolidButton}">
|
||||
Danger
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBlock>Borderless</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
@ -32,7 +41,49 @@
|
||||
<Button Classes="Tertiary" Theme="{DynamicResource BorderlessButton}">Tertiary</Button>
|
||||
<Button Classes="Warning" Theme="{DynamicResource BorderlessButton}">Warning</Button>
|
||||
<Button Classes="Danger" Theme="{DynamicResource BorderlessButton}">Danger</Button>
|
||||
<Button Classes="Primary" IsEnabled="False" Theme="{DynamicResource BorderlessButton}">Danger</Button>
|
||||
<Button
|
||||
Classes="Primary"
|
||||
IsEnabled="False"
|
||||
Theme="{DynamicResource BorderlessButton}">
|
||||
Danger
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBlock>DropdownButton</TextBlock>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<DropDownButton Content="Submit">
|
||||
<DropDownButton.Flyout>
|
||||
<MenuFlyout Placement="BottomEdgeAlignedRight">
|
||||
<MenuItem Header="Submit All" />
|
||||
<MenuItem Header="Submit Updated" />
|
||||
</MenuFlyout>
|
||||
</DropDownButton.Flyout>
|
||||
</DropDownButton>
|
||||
<DropDownButton Content="Submit" Theme="{DynamicResource SolidDropdownButton}">
|
||||
<DropDownButton.Flyout>
|
||||
<MenuFlyout Placement="BottomEdgeAlignedRight">
|
||||
<MenuItem Header="Submit All" />
|
||||
<MenuItem Header="Submit Updated" />
|
||||
</MenuFlyout>
|
||||
</DropDownButton.Flyout>
|
||||
</DropDownButton>
|
||||
<DropDownButton Content="Submit" Theme="{DynamicResource BorderlessDropdownButton}">
|
||||
<DropDownButton.Flyout>
|
||||
<MenuFlyout Placement="BottomEdgeAlignedRight">
|
||||
<MenuItem Header="Submit All" />
|
||||
<MenuItem Header="Submit Updated" />
|
||||
</MenuFlyout>
|
||||
</DropDownButton.Flyout>
|
||||
</DropDownButton>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<SplitButton Content="Submit">
|
||||
<SplitButton.Flyout>
|
||||
<MenuFlyout Placement="BottomEdgeAlignedRight">
|
||||
<MenuItem Header="Submit All" />
|
||||
<MenuItem Header="Submit Updated" />
|
||||
</MenuFlyout>
|
||||
</SplitButton.Flyout>
|
||||
</SplitButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
3
src/Semi.Avalonia/Controls/CaptionButtons.axaml
Normal file
3
src/Semi.Avalonia/Controls/CaptionButtons.axaml
Normal file
@ -0,0 +1,3 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
</ResourceDictionary>
|
@ -7,6 +7,7 @@
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ButtonSpinner.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/Calendar.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/CalendarDatePicker.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/CaptionButtons.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/Carousel.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/CheckBox.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ComboBox.axaml" />
|
||||
@ -14,6 +15,7 @@
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ContextMenu.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/DatePicker.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/DateTimePickerShared.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/DropdownButton.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/Expander.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/FlyoutPresenter.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/GridSplitter.axaml" />
|
||||
@ -32,12 +34,14 @@
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/SelectableTextBlock.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ScrollViewer.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/Slider.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/SplitButton.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/TabControl.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/TabItem.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/TabStrip.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/TextBlock.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/TextBox.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/TimePicker.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/TitleBar.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ToggleButton.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ToggleSwitch.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Controls/Tooltip.axaml" />
|
||||
|
234
src/Semi.Avalonia/Controls/DropdownButton.axaml
Normal file
234
src/Semi.Avalonia/Controls/DropdownButton.axaml
Normal file
@ -0,0 +1,234 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<ControlTheme x:Key="{x:Type DropDownButton}" TargetType="DropDownButton">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonDefaultBackground}" />
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
|
||||
<Setter Property="DropDownButton.CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
|
||||
<Setter Property="DropDownButton.BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
|
||||
<Setter Property="DropDownButton.Padding" Value="{DynamicResource ButtonDefaultPadding}" />
|
||||
<Setter Property="DropDownButton.RenderTransform" Value="none" />
|
||||
<Setter Property="DropDownButton.FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
|
||||
<Setter Property="DropDownButton.FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
|
||||
<Setter Property="DropDownButton.HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="DropDownButton.VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="DropDownButton.MinHeight" Value="12" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="DropDownButton">
|
||||
<Border
|
||||
x:Name="RootBorder"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid x:Name="InnerGrid" ColumnDefinitions="*,Auto">
|
||||
<ContentPresenter
|
||||
x:Name="PART_ContentPresenter"
|
||||
Grid.Column="0"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
RecognizesAccessKey="True" />
|
||||
<PathIcon
|
||||
x:Name="DropDownGlyph"
|
||||
Grid.Column="1"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Margin="0,0,8,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Data="{DynamicResource DropdownButtonIconGlyph}"
|
||||
Foreground="{DynamicResource ComboBoxDropDownGlyphForeground}"
|
||||
IsHitTestVisible="False"
|
||||
UseLayoutRounding="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="RenderTransform" Value="scale(0.98)" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Primary">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Secondary">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultSecondaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Tertiary">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Warning">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultWarningForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Danger">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultDangerForeground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonDefaultPointeroverBorderBrush}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonDefaultPressedBorderBrush}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Large">
|
||||
<Setter Property="DropDownButton.Padding" Value="{DynamicResource ButtonLargePadding}" />
|
||||
</Style>
|
||||
<Style Selector="^.Small">
|
||||
<Setter Property="DropDownButton.Padding" Value="{DynamicResource ButtonSmallPadding}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="SolidDropdownButton" TargetType="DropDownButton">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
|
||||
<Setter Property="DropDownButton.CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
|
||||
<Setter Property="DropDownButton.BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
|
||||
<Setter Property="DropDownButton.Padding" Value="{DynamicResource ButtonDefaultPadding}" />
|
||||
<Setter Property="DropDownButton.RenderTransform" Value="none" />
|
||||
<Setter Property="DropDownButton.FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
|
||||
<Setter Property="DropDownButton.FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
|
||||
<Setter Property="DropDownButton.HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="DropDownButton.VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="DropDownButton.MinHeight" Value="12" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="DropDownButton">
|
||||
<Border
|
||||
x:Name="RootBorder"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid x:Name="InnerGrid" ColumnDefinitions="*,Auto">
|
||||
<ContentPresenter
|
||||
x:Name="PART_ContentPresenter"
|
||||
Grid.Column="0"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
RecognizesAccessKey="True" />
|
||||
<PathIcon
|
||||
x:Name="DropDownGlyph"
|
||||
Grid.Column="1"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Margin="0,0,8,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Data="{DynamicResource DropdownButtonIconGlyph}"
|
||||
Foreground="{DynamicResource ComboBoxDropDownGlyphForeground}"
|
||||
IsHitTestVisible="False"
|
||||
UseLayoutRounding="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="RenderTransform" Value="scale(0.98)" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Primary">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Secondary">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidSecondaryBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidSecondaryBorderBrush}" />
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidSecondaryPointeroverBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidSecondaryPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidSecondaryPressedBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidSecondaryPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Tertiary">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidTertiaryBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidTertiaryBorderBrush}" />
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidTertiaryPointeroverBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidTertiaryPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidTertiaryPressedBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidTertiaryPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Warning">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidWarningBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidWarningBorderBrush}" />
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidWarningPointeroverBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidWarningPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidWarningPressedBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidWarningPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Danger">
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidDangerBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidDangerBorderBrush}" />
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidDangerPointeroverBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidDangerPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonSolidDangerPressedBackground}" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonSolidDangerPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
|
||||
<Setter Property="DropDownButton.Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme
|
||||
x:Key="BorderlessDropdownButton"
|
||||
BasedOn="{StaticResource {x:Type DropDownButton}}"
|
||||
TargetType="DropDownButton">
|
||||
<Setter Property="DropDownButton.Background" Value="Transparent" />
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="Transparent" />
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="DropDownButton.BorderBrush" Value="Transparent" />
|
||||
<Setter Property="DropDownButton.Background" Value="Transparent" />
|
||||
<Setter Property="DropDownButton.Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
84
src/Semi.Avalonia/Controls/SplitButton.axaml
Normal file
84
src/Semi.Avalonia/Controls/SplitButton.axaml
Normal file
@ -0,0 +1,84 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="using:Avalonia.Controls.Converters">
|
||||
|
||||
<ControlTheme x:Key="{x:Type SplitButton}" TargetType="SplitButton">
|
||||
<Setter Property="SplitButton.Background" Value="{DynamicResource ButtonDefaultBackground}" />
|
||||
<Setter Property="SplitButton.Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
|
||||
<Setter Property="SplitButton.BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
|
||||
<Setter Property="SplitButton.CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
|
||||
<Setter Property="SplitButton.BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
|
||||
<Setter Property="SplitButton.Padding" Value="{DynamicResource ButtonDefaultPadding}" />
|
||||
<Setter Property="SplitButton.RenderTransform" Value="none" />
|
||||
<Setter Property="SplitButton.FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
|
||||
<Setter Property="SplitButton.FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
|
||||
<Setter Property="SplitButton.HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="SplitButton.VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="SplitButton.MinHeight" Value="12" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="SplitButton">
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid ColumnDefinitions="*,Auto,Auto">
|
||||
<Button
|
||||
x:Name="PART_PrimaryButton"
|
||||
Grid.Column="0"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Command="{TemplateBinding Command}"
|
||||
CommandParameter="{TemplateBinding CommandParameter}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
CornerRadius="3 0 0 3"
|
||||
Focusable="False"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
KeyboardNavigation.IsTabStop="False" />
|
||||
|
||||
<Border
|
||||
x:Name="SeparatorBorder"
|
||||
Grid.Column="1"
|
||||
Width="{DynamicResource SplitButtonSeparatorWidth}"
|
||||
Background="White"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="0.5" />
|
||||
|
||||
<Button
|
||||
x:Name="PART_SecondaryButton"
|
||||
Grid.Column="2"
|
||||
Padding="4,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="0 3 3 0"
|
||||
Focusable="False"
|
||||
KeyboardNavigation.IsTabStop="False">
|
||||
<PathIcon
|
||||
Width="12"
|
||||
Height="12"
|
||||
Data="{DynamicResource SplitButtonIconGlyph}"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
3
src/Semi.Avalonia/Controls/TitleBar.axaml
Normal file
3
src/Semi.Avalonia/Controls/TitleBar.axaml
Normal file
@ -0,0 +1,3 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
</ResourceDictionary>
|
4
src/Semi.Avalonia/Themes/Light/DropdownButton.axaml
Normal file
4
src/Semi.Avalonia/Themes/Light/DropdownButton.axaml
Normal file
@ -0,0 +1,4 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<PathGeometry x:Key="DropdownButtonIconGlyph">M4.08045 7.59809C4.66624 7.01231 5.61599 7.01231 6.20177 7.59809L11.8586 13.2549L17.5155 7.59809C18.1013 7.01231 19.051 7.01231 19.6368 7.59809C20.2226 8.18388 20.2226 9.13363 19.6368 9.71941L12.9193 16.4369C12.3335 17.0227 11.3838 17.0227 10.798 16.4369L4.08045 9.71941C3.49467 9.13363 3.49467 8.18388 4.08045 7.59809Z</PathGeometry>
|
||||
</ResourceDictionary>
|
@ -12,6 +12,7 @@
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/ComboBox.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/DatePicker.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/DateTimePickerShared.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/DropdownButton.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/Expander.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/GridSplitter.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/Label.axaml" />
|
||||
@ -23,6 +24,7 @@
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/RadioButton.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/ScrollViewer.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/Slider.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/SplitButton.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/TabControl.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/TabItem.axaml" />
|
||||
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/TextBlock.axaml" />
|
||||
|
8
src/Semi.Avalonia/Themes/Light/SplitButton.axaml
Normal file
8
src/Semi.Avalonia/Themes/Light/SplitButton.axaml
Normal file
@ -0,0 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=System.Runtime">
|
||||
<!-- Add Resources Here -->
|
||||
<PathGeometry x:Key="SplitButtonIconGlyph">M20.5598 9.65618L12.7546 18.6322C12.3559 19.0906 11.644 19.0906 11.2453 18.6322L3.4401 9.65618C2.8773 9.00895 3.33701 8 4.19471 8L19.8052 8C20.6629 8 21.1226 9.00895 20.5598 9.65618Z</PathGeometry>
|
||||
<sys:Double x:Key="SplitButtonSeparatorWidth">1</sys:Double>
|
||||
</ResourceDictionary>
|
Loading…
x
Reference in New Issue
Block a user