Added IconRepeatButton, IconDropDownButton, IconSplitButton, IconToggleButton, IconToggleSplitButton (#834)
* Added IconRepeatButton (#812) * Replaced control-specific PART_RootPanel workaround with AffectsArrange call fixing ReversibleStackPanel for the whole application. * Added IconToggleButton (#812) * Split IconRepeatButton into separate XAML file. * Added IconSplitButton (#812) * Added BindableClasses utility to allow propagating Classes property between controls. Avalonia currently doesn't support binding from Classes property, and binding to Classes property is heavily restricted. * Added IconToggleSplitButton (#812) * Fixed tab order in IconSplitButton and IconToggleSplitButton (DockPanel messes up tab order, TabIndex is global and makes it even worse, so just switched to Grid). * Added IconDropDownButton (#812) * Fixed IconPlacement inheritance. * Added redesigned IconButton demo section (#812) * Fixed spacing issues * Added redesigned demo sections for the newly added icon buttons (#812) * Replaced BindableClasses with ClassHelper. Fixed styling of default solid split icon buttons. (#812) * Replaced IIconButton with attached-like property getters and PseudolassesExtensions.Set(Classes); fixed arrow alignments in top/bottom split icon buttons (#812) * Applied fixes suggested by Copilot in code review (#812) * Fixed incorrect base type of IconDropDownButton (#812) * Fixed IconSplitButton and IconToggleSplitButton styles (#812) * Fixed secondary button color in checked state * Fixed applying of CornerRadius * Changed secondary button to square * Simplified template * Disabled demo of Colorful theme for IconSplitButton and IconToggleSplitButton
This commit is contained in:
committed by
GitHub
parent
a4906d5130
commit
6f7db1c20c
@@ -8,60 +8,564 @@
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels"
|
||||
xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
|
||||
d:DesignHeight="NaN"
|
||||
d:DesignWidth="800"
|
||||
d:DesignWidth="1200"
|
||||
x:DataType="vm:IconButtonDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<Design.DataContext>
|
||||
<vm:IconButtonDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<Control.Styles>
|
||||
<Style Selector="u|IconDropDownButton, u|IconSplitButton, u|IconToggleSplitButton">
|
||||
<Setter Property="Button.Flyout">
|
||||
<MenuFlyout Placement="BottomEdgeAlignedRight">
|
||||
<MenuItem Header="Submit All" />
|
||||
<MenuItem Header="Submit Updated" />
|
||||
</MenuFlyout>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style Selector="Label">
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style Selector="ToggleSwitch">
|
||||
<Setter Property="Theme" Value="{StaticResource SimpleToggleSwitch}" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.Header">
|
||||
<Setter Property="Theme" Value="{StaticResource TitleTextBlock}" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style Selector="u|EnumSelector.IconPlacement">
|
||||
<Setter Property="EnumType" Value="common:Position" />
|
||||
<Setter Property="Value" Value="{x:Static common:Position.Left}" />
|
||||
</Style>
|
||||
</Control.Styles>
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20" Spacing="8" HorizontalAlignment="Left" Width="500">
|
||||
<Border Theme="{StaticResource CardBorder}">
|
||||
<StackPanel Margin="20" Spacing="8" HorizontalAlignment="Left">
|
||||
|
||||
<HeaderedContentControl Theme="{StaticResource GroupBox}">
|
||||
<HeaderedContentControl.Header>
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="8" TextElement.FontWeight="Normal">
|
||||
<Label Content="Loading" />
|
||||
<ToggleSwitch x:Name="chkIsIconButtonLoading" />
|
||||
<Label Content="Icon" Margin="16 0 0 0" />
|
||||
<u:EnumSelector x:Name="selIconButtonIconPlacement" Classes="IconPlacement" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="IconButton / IconRepeatButton" Classes="Header H6" />
|
||||
</DockPanel>
|
||||
</HeaderedContentControl.Header>
|
||||
<Control.Styles>
|
||||
<Style Selector="u|IconButton">
|
||||
<Setter Property="IsLoading" Value="{Binding #chkIsIconButtonLoading.IsChecked}" />
|
||||
<Setter Property="IconPlacement" Value="{Binding #selIconButtonIconPlacement.Value}" />
|
||||
</Style>
|
||||
</Control.Styles>
|
||||
<Panel>
|
||||
<StackPanel Spacing="8">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
|
||||
<TextBlock Text="Kind" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconButton Icon="🐼" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" IsEnabled="False" />
|
||||
<u:IconButton Content="Text" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Text with icon" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Loading" IsLoading="True" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Size" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Large" Classes="Large" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Default" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Small" Classes="Small" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Theme" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Light" Width="80"
|
||||
ToolTip.Tip="Default theme" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Default" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Solid" Width="80"
|
||||
ToolTip.Tip="SolidIconButton / SolidIconRepeatButton theme" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource SolidIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Outline" Width="80"
|
||||
ToolTip.Tip="OutlineIconButton / OutlineIconRepeatButton theme" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource OutlineIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Borderless" Width="80"
|
||||
ToolTip.Tip="BorderlessIconButton / BorderlessIconRepeatButton theme" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource BorderlessIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Theme – Colorful (AI style)" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Light" Width="80"
|
||||
ToolTip.Tip="Default theme" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" IsEnabled="False" />
|
||||
<Label Content="Solid" Width="80" Margin="20 0 0 0"
|
||||
ToolTip.Tip="SolidIconButton / SolidIconRepeatButton theme" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource SolidIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Outline" Width="80"
|
||||
ToolTip.Tip="OutlineIconButton / OutlineIconRepeatButton theme" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource OutlineIconButton}" IsEnabled="False" />
|
||||
<Label Content="Borderless" Width="80" Margin="20 0 0 0"
|
||||
ToolTip.Tip="BorderlessIconButton / BorderlessIconRepeatButton theme" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource BorderlessIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<u:IconButton
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
<u:IconButton
|
||||
Classes="Secondary"
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
<u:IconButton
|
||||
Classes="Warning"
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
<u:IconButton
|
||||
Classes="Danger"
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
</Panel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Theme="{StaticResource GroupBox}">
|
||||
<HeaderedContentControl.Header>
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="8" TextElement.FontWeight="Normal">
|
||||
<Label Content="Loading" />
|
||||
<ToggleSwitch x:Name="chkIsIconDropDownButtonLoading" />
|
||||
<Label Content="Icon" Margin="16 0 0 0" />
|
||||
<u:EnumSelector x:Name="selIconDropDownButtonIconPlacement" Classes="IconPlacement" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<u:IconButton
|
||||
Theme="{StaticResource SolidIconButton}"
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
<u:IconButton
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
<u:IconButton
|
||||
Theme="{StaticResource BorderlessIconButton}"
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
<u:IconButton
|
||||
Theme="{StaticResource OutlineIconButton}"
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
<TextBlock Text="IconDropDownButton" Classes="Header H6" />
|
||||
</DockPanel>
|
||||
</HeaderedContentControl.Header>
|
||||
<Control.Styles>
|
||||
<Style Selector="u|IconDropDownButton">
|
||||
<Setter Property="IsLoading" Value="{Binding #chkIsIconDropDownButtonLoading.IsChecked}" />
|
||||
<Setter Property="IconPlacement" Value="{Binding #selIconDropDownButtonIconPlacement.Value}" />
|
||||
</Style>
|
||||
</Control.Styles>
|
||||
<Panel>
|
||||
<StackPanel Spacing="8">
|
||||
|
||||
<TextBlock Text="Kind" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconDropDownButton Icon="🐼" />
|
||||
<u:IconDropDownButton Content="Text" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Text with icon" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Loading" IsLoading="True" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Size" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Large" Classes="Large" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Default" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Small" Classes="Small" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Theme" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Light" Width="80"
|
||||
ToolTip.Tip="Default theme" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Default" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Solid" Width="80"
|
||||
ToolTip.Tip="SolidIconDropDownButton / SolidIconRepeatButton theme" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource SolidIconDropDownButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Outline" Width="80"
|
||||
ToolTip.Tip="OutlineIconDropDownButton / OutlineIconRepeatButton theme" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource OutlineIconDropDownButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Borderless" Width="80"
|
||||
ToolTip.Tip="BorderlessIconDropDownButton / BorderlessIconRepeatButton theme" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource BorderlessIconDropDownButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Theme – Colorful (AI style)" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Light" Width="80"
|
||||
ToolTip.Tip="Default theme" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" IsEnabled="False" />
|
||||
<Label Content="Solid" Width="80" Margin="20 0 0 0"
|
||||
ToolTip.Tip="SolidIconDropDownButton / SolidIconRepeatButton theme" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource SolidIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource SolidIconDropDownButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Outline" Width="80"
|
||||
ToolTip.Tip="OutlineIconDropDownButton / OutlineIconRepeatButton theme" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource OutlineIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource OutlineIconDropDownButton}" IsEnabled="False" />
|
||||
<Label Content="Borderless" Width="80" Margin="20 0 0 0"
|
||||
ToolTip.Tip="BorderlessIconDropDownButton / BorderlessIconRepeatButton theme" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource BorderlessIconDropDownButton}" />
|
||||
<u:IconDropDownButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource BorderlessIconDropDownButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<u:IconButton
|
||||
Theme="{StaticResource SolidIconButton}"
|
||||
Icon="{StaticResource SemiIconSidebar}"
|
||||
Content="收起" />
|
||||
<u:IconButton
|
||||
Theme="{StaticResource SolidIconButton}"
|
||||
IconPlacement="Right"
|
||||
Icon="{StaticResource SemiIconChevronDown}"
|
||||
Content="展开选项" />
|
||||
</Panel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Theme="{StaticResource GroupBox}">
|
||||
<HeaderedContentControl.Header>
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="8" TextElement.FontWeight="Normal">
|
||||
<Label Content="Loading" />
|
||||
<ToggleSwitch x:Name="chkIsIconSplitButtonLoading" />
|
||||
<Label Content="Icon" Margin="16 0 0 0" />
|
||||
<u:EnumSelector x:Name="selIconSplitButtonIconPlacement" Classes="IconPlacement" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="IconSplitButton" Classes="Header H6" />
|
||||
</DockPanel>
|
||||
</HeaderedContentControl.Header>
|
||||
<Control.Styles>
|
||||
<Style Selector="u|IconSplitButton">
|
||||
<Setter Property="IsLoading" Value="{Binding #chkIsIconSplitButtonLoading.IsChecked}" />
|
||||
<Setter Property="IconPlacement" Value="{Binding #selIconSplitButtonIconPlacement.Value}" />
|
||||
</Style>
|
||||
</Control.Styles>
|
||||
<Panel>
|
||||
<StackPanel Spacing="8">
|
||||
|
||||
<TextBlock Text="Kind" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconSplitButton Icon="🐼" />
|
||||
<u:IconSplitButton Content="Text" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Text with icon" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Loading" IsLoading="True" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Size" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Large" Classes="Large" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Default" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Small" Classes="Small" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Theme" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Light" Width="80"
|
||||
ToolTip.Tip="Default theme" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Default" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Solid" Width="80"
|
||||
ToolTip.Tip="SolidIconSplitButton / SolidIconRepeatButton theme" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource SolidIconSplitButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Outline" Width="80"
|
||||
ToolTip.Tip="OutlineIconSplitButton / OutlineIconRepeatButton theme" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource OutlineIconSplitButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Borderless" Width="80"
|
||||
ToolTip.Tip="BorderlessIconSplitButton / BorderlessIconRepeatButton theme" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Default" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Primary" Classes="Primary" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Secondary" Classes="Secondary" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Tertiary" Classes="Tertiary" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Success" Classes="Success" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Warning" Classes="Warning" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Danger" Classes="Danger" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" Classes="Danger" Theme="{DynamicResource BorderlessIconSplitButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<!--<TextBlock Text="Theme – Colorful (AI style)" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Light" Width="80"
|
||||
ToolTip.Tip="Default theme" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" IsEnabled="False" />
|
||||
<Label Content="Solid" Width="80" Margin="20 0 0 0"
|
||||
ToolTip.Tip="SolidIconSplitButton / SolidIconRepeatButton theme" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource SolidIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource SolidIconSplitButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Outline" Width="80"
|
||||
ToolTip.Tip="OutlineIconSplitButton / OutlineIconRepeatButton theme" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource OutlineIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource OutlineIconSplitButton}" IsEnabled="False" />
|
||||
<Label Content="Borderless" Width="80" Margin="20 0 0 0"
|
||||
ToolTip.Tip="BorderlessIconSplitButton / BorderlessIconRepeatButton theme" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{DynamicResource BorderlessIconSplitButton}" />
|
||||
<u:IconSplitButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Danger" Theme="{DynamicResource BorderlessIconSplitButton}" IsEnabled="False" />
|
||||
</WrapPanel>-->
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Panel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Theme="{StaticResource GroupBox}">
|
||||
<HeaderedContentControl.Header>
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="8" TextElement.FontWeight="Normal">
|
||||
<Label Content="Loading" />
|
||||
<ToggleSwitch x:Name="chkIsIconToggleButtonLoading" />
|
||||
<Label Content="Icon" Margin="16 0 0 0" />
|
||||
<u:EnumSelector x:Name="selIconToggleButtonIconPlacement" Classes="IconPlacement" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="IconToggleButton" Classes="Header H6" />
|
||||
</DockPanel>
|
||||
</HeaderedContentControl.Header>
|
||||
<Control.Styles>
|
||||
<Style Selector="u|IconToggleButton">
|
||||
<Setter Property="IsLoading" Value="{Binding #chkIsIconToggleButtonLoading.IsChecked}" />
|
||||
<Setter Property="IconPlacement" Value="{Binding #selIconToggleButtonIconPlacement.Value}" />
|
||||
</Style>
|
||||
</Control.Styles>
|
||||
<Panel>
|
||||
<StackPanel Spacing="8">
|
||||
|
||||
<TextBlock Text="Kind" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconToggleButton Icon="🐼" />
|
||||
<u:IconToggleButton Content="Text" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsThreeState="True" Content="Text with icon" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsThreeState="True" Content="Loading" IsLoading="True" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsThreeState="True" Content="Disabled" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Size" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsThreeState="True" Content="Large" Classes="Large" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsThreeState="True" Content="Default" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsThreeState="True" Content="Small" Classes="Small" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="State" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Unchecked" Width="100" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" IsThreeState="True" Content="Default" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" IsThreeState="True" Content="Primary" Classes="Primary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" IsThreeState="True" Content="Secondary" Classes="Secondary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" IsThreeState="True" Content="Tertiary" Classes="Tertiary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" IsThreeState="True" Content="Success" Classes="Success" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" IsThreeState="True" Content="Warning" Classes="Warning" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" IsThreeState="True" Content="Danger" Classes="Danger" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" IsThreeState="True" Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Checked" Width="100" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" IsThreeState="True" Content="Default" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" IsThreeState="True" Content="Primary" Classes="Primary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" IsThreeState="True" Content="Secondary" Classes="Secondary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" IsThreeState="True" Content="Tertiary" Classes="Tertiary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" IsThreeState="True" Content="Success" Classes="Success" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" IsThreeState="True" Content="Warning" Classes="Warning" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" IsThreeState="True" Content="Danger" Classes="Danger" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" IsThreeState="True" Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Indeterminate" Width="100" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="{x:Null}" IsThreeState="True" Content="Default" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="{x:Null}" IsThreeState="True" Content="Primary" Classes="Primary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="{x:Null}" IsThreeState="True" Content="Secondary" Classes="Secondary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="{x:Null}" IsThreeState="True" Content="Tertiary" Classes="Tertiary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="{x:Null}" IsThreeState="True" Content="Success" Classes="Success" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="{x:Null}" IsThreeState="True" Content="Warning" Classes="Warning" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="{x:Null}" IsThreeState="True" Content="Danger" Classes="Danger" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconCamera}" IsChecked="{x:Null}" IsThreeState="True" Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="State – Colorful (AI style)" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Unchecked" Width="100" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="False" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="False" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="False" Content="Disabled" Classes="Colorful Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Checked" Width="100" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="True" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="True" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="True" Content="Disabled" Classes="Colorful Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Indeterminate" Width="100" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="{x:Null}" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="{x:Null}" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconToggleButton Icon="{StaticResource SemiIconAIFilled}" IsThreeState="True" IsChecked="{x:Null}" Content="Disabled" Classes="Colorful Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Theme="{StaticResource GroupBox}">
|
||||
<HeaderedContentControl.Header>
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="8" TextElement.FontWeight="Normal">
|
||||
<Label Content="Loading" />
|
||||
<ToggleSwitch x:Name="chkIsIconToggleSplitButtonLoading" />
|
||||
<Label Content="Icon" Margin="16 0 0 0" />
|
||||
<u:EnumSelector x:Name="selIconToggleSplitButtonIconPlacement" Classes="IconPlacement" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="IconToggleSplitButton" Classes="Header H6" />
|
||||
</DockPanel>
|
||||
</HeaderedContentControl.Header>
|
||||
<Control.Styles>
|
||||
<Style Selector="u|IconToggleSplitButton">
|
||||
<Setter Property="IsLoading" Value="{Binding #chkIsIconToggleSplitButtonLoading.IsChecked}" />
|
||||
<Setter Property="IconPlacement" Value="{Binding #selIconToggleSplitButtonIconPlacement.Value}" />
|
||||
</Style>
|
||||
</Control.Styles>
|
||||
<Panel>
|
||||
<StackPanel Spacing="8">
|
||||
|
||||
<TextBlock Text="Kind" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconToggleSplitButton Icon="🐼" />
|
||||
<u:IconToggleSplitButton Content="Text" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" Content="Text with icon" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" Content="Loading" IsLoading="True" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" Content="Disabled" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="Size" FontWeight="Bold" />
|
||||
<WrapPanel Orientation="Horizontal" ItemSpacing="8" LineSpacing="8">
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" Content="Large" Classes="Large" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" Content="Default" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" Content="Small" Classes="Small" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="State" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Unchecked" Width="100" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" Content="Default" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" Content="Primary" Classes="Primary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" Content="Secondary" Classes="Secondary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" Content="Tertiary" Classes="Tertiary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" Content="Success" Classes="Success" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" Content="Warning" Classes="Warning" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" Content="Danger" Classes="Danger" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="False" Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Checked" Width="100" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" Content="Default" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" Content="Primary" Classes="Primary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" Content="Secondary" Classes="Secondary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" Content="Tertiary" Classes="Tertiary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" Content="Success" Classes="Success" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" Content="Warning" Classes="Warning" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" Content="Danger" Classes="Danger" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconCamera}" IsChecked="True" Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
|
||||
<!--<TextBlock Text="State – Colorful (AI style)" FontWeight="Bold" />
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Unchecked" Width="100" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconAIFilled}" IsChecked="False" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconAIFilled}" IsChecked="False" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconAIFilled}" IsChecked="False" Content="Disabled" Classes="Colorful Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="8">
|
||||
<Label Content="Checked" Width="100" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconAIFilled}" IsChecked="True" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconAIFilled}" IsChecked="True" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconToggleSplitButton Icon="{StaticResource SemiIconAIFilled}" IsChecked="True" Content="Disabled" Classes="Colorful Danger" IsEnabled="False" />
|
||||
</WrapPanel>-->
|
||||
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<Border Theme="{StaticResource CardBorder}">
|
||||
<StackPanel Spacing="8">
|
||||
@@ -108,6 +612,12 @@
|
||||
EnumType="common:Position"
|
||||
Value="{Binding SelectedPosition}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<u:IconButton
|
||||
HorizontalAlignment="Left"
|
||||
IsLoading="{Binding IsLoading2}"
|
||||
IconPlacement="{Binding SelectedPosition}"
|
||||
Icon="{StaticResource SemiIconCamera}" />
|
||||
<u:IconButton
|
||||
HorizontalAlignment="Left"
|
||||
IsLoading="{Binding IsLoading2}"
|
||||
@@ -120,6 +630,13 @@
|
||||
IconPlacement="{Binding SelectedPosition}"
|
||||
Icon="🐼"
|
||||
Content="Hello Panda" />
|
||||
<u:IconButton
|
||||
HorizontalAlignment="Left"
|
||||
IsLoading="{Binding IsLoading2}"
|
||||
IconPlacement="{Binding SelectedPosition}"
|
||||
Content="Hello Text" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<u:IconButton
|
||||
HorizontalAlignment="Left"
|
||||
IsLoading="{Binding IsLoading2}"
|
||||
@@ -142,6 +659,7 @@
|
||||
<TextBlock FontSize="40" Text="🐼" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<u:IconButton
|
||||
IsLoading="{Binding IsLoading2}"
|
||||
@@ -159,51 +677,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Theme="{StaticResource CardBorder}">
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="16">
|
||||
<WrapPanel ItemSpacing="16" LineSpacing="16">
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Primary" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16" LineSpacing="16">
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{StaticResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource SolidIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16" LineSpacing="16">
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{StaticResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource OutlineIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16" LineSpacing="16">
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Primary" Classes="Colorful Primary" Theme="{StaticResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource BorderlessIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16" LineSpacing="16">
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Primary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Tertiary" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Primary" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16" LineSpacing="16">
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Primary" Theme="{StaticResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Tertiary" Theme="{StaticResource SolidIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Primary" Theme="{StaticResource SolidIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16" LineSpacing="16">
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Primary" Theme="{StaticResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Tertiary" Theme="{StaticResource OutlineIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Primary" Theme="{StaticResource OutlineIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16" LineSpacing="16">
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Primary" Theme="{StaticResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Tertiary" Theme="{StaticResource BorderlessIconButton}" />
|
||||
<u:IconButton Icon="{StaticResource SemiIconAIFilled}" Classes="Colorful Primary" Theme="{StaticResource BorderlessIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -4,8 +4,22 @@
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:converters="using:Ursa.Themes.Semi.Converters">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Margin="16" Spacing="16">
|
||||
<ThemeVariantScope RequestedThemeVariant="Dark">
|
||||
<StackPanel Spacing="16" Background="{DynamicResource SemiColorBackground0}">
|
||||
<Control.Styles>
|
||||
<Style Selector="Label">
|
||||
<Setter Property="Classes.Tertiary" Value="True" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="MinWidth" Value="140" />
|
||||
</Style>
|
||||
<Style Selector="u|IconButton">
|
||||
<Setter Property="Icon" Value="👍" />
|
||||
<Setter Property="IconPlacement" Value="Left" />
|
||||
<Setter Property="IsLoading" Value="False" />
|
||||
</Style>
|
||||
</Control.Styles>
|
||||
<WrapPanel ItemSpacing="16">
|
||||
<Label Content="" />
|
||||
<u:IconButton Content="Default" />
|
||||
<u:IconButton Content="Primary" Classes="Primary" />
|
||||
<u:IconButton Content="Secondary" Classes="Secondary" />
|
||||
@@ -16,6 +30,7 @@
|
||||
<u:IconButton Content="Disabled" Classes="Danger" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16">
|
||||
<Label Content="Solid" />
|
||||
<u:IconButton Content="Default" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Content="Primary" Classes="Primary" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Content="Secondary" Classes="Secondary" Theme="{DynamicResource SolidIconButton}" />
|
||||
@@ -26,6 +41,7 @@
|
||||
<u:IconButton Content="Disabled" Classes="Danger" Theme="{DynamicResource SolidIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16">
|
||||
<Label Content="Outline" />
|
||||
<u:IconButton Content="Default" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Content="Primary" Classes="Primary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Content="Secondary" Classes="Secondary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
@@ -36,6 +52,7 @@
|
||||
<u:IconButton Content="Disabled" Classes="Danger" Theme="{DynamicResource OutlineIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16">
|
||||
<Label Content="Borderless" />
|
||||
<u:IconButton Content="Default" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Content="Primary" Classes="Primary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Content="Secondary" Classes="Secondary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
@@ -46,6 +63,7 @@
|
||||
<u:IconButton Content="Disabled" Classes="Danger" Theme="{DynamicResource BorderlessIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16">
|
||||
<Label Content="Colorful" />
|
||||
<u:IconButton Content="Default" Classes="Colorful" />
|
||||
<u:IconButton Content="Primary" Classes="Colorful Primary" />
|
||||
<u:IconButton Content="Secondary" Classes="Colorful Secondary" />
|
||||
@@ -56,6 +74,7 @@
|
||||
<u:IconButton Content="Disabled" Classes="Colorful Primary" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16">
|
||||
<Label Content="Colorful Solid" />
|
||||
<u:IconButton Content="Default" Classes="Colorful" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource SolidIconButton}" />
|
||||
<u:IconButton Content="Secondary" Classes="Colorful Secondary" Theme="{DynamicResource SolidIconButton}" />
|
||||
@@ -66,6 +85,7 @@
|
||||
<u:IconButton Content="Disabled" Classes="Colorful Primary" Theme="{DynamicResource SolidIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16">
|
||||
<Label Content="Colorful Outline" />
|
||||
<u:IconButton Content="Default" Classes="Colorful" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
<u:IconButton Content="Secondary" Classes="Colorful Secondary" Theme="{DynamicResource OutlineIconButton}" />
|
||||
@@ -76,6 +96,7 @@
|
||||
<u:IconButton Content="Disabled" Classes="Colorful Primary" Theme="{DynamicResource OutlineIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
<WrapPanel ItemSpacing="16">
|
||||
<Label Content="Colorful Borderless" />
|
||||
<u:IconButton Content="Default" Classes="Colorful" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Content="Primary" Classes="Colorful Primary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
<u:IconButton Content="Secondary" Classes="Colorful Secondary" Theme="{DynamicResource BorderlessIconButton}" />
|
||||
@@ -86,27 +107,10 @@
|
||||
<u:IconButton Content="Disabled" Classes="Colorful Primary" Theme="{DynamicResource BorderlessIconButton}" IsEnabled="False" />
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</ThemeVariantScope>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:IconButton}" TargetType="u:IconButton">
|
||||
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource ButtonDefaultHeight}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
|
||||
<Setter Property="FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
|
||||
<Setter Property="RenderTransform" Value="none" />
|
||||
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:IconButton">
|
||||
<ControlTemplate x:Key="IconButtonTemplate" TargetType="ContentControl">
|
||||
<Border
|
||||
Name="PART_Background"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
@@ -121,19 +125,17 @@
|
||||
<Panel Name="PART_IconRoot">
|
||||
<Panel.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.Or}">
|
||||
<Binding Path="IsLoading" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
<Binding
|
||||
Converter="{x:Static ObjectConverters.IsNotNull}"
|
||||
Path="Icon"
|
||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
<Binding Path="(u:IconButton.IsLoading)" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
<Binding Path="(u:IconButton.Icon)" RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Converter="{x:Static ObjectConverters.IsNotNull}" />
|
||||
</MultiBinding>
|
||||
</Panel.IsVisible>
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding Icon}"
|
||||
ContentTemplate="{TemplateBinding IconTemplate}"
|
||||
Content="{TemplateBinding (u:IconButton.Icon)}"
|
||||
ContentTemplate="{TemplateBinding (u:IconButton.IconTemplate)}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Foreground="{Binding #PART_ContentPresenter.Foreground}"
|
||||
Opacity="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=!IsLoading, Converter={converters:BooleansToOpacityConverter}}">
|
||||
Opacity="{Binding !(u:IconButton.IsLoading), RelativeSource={RelativeSource TemplatedParent}, Converter={converters:BooleansToOpacityConverter}}">
|
||||
<ContentPresenter.DataTemplates>
|
||||
<DataTemplate DataType="Geometry">
|
||||
<PathIcon
|
||||
@@ -145,8 +147,8 @@
|
||||
<u:LoadingIcon
|
||||
Classes="Small"
|
||||
Foreground="{Binding #PART_ContentPresenter.Foreground}"
|
||||
IsLoading="{TemplateBinding IsLoading}"
|
||||
IsVisible="{TemplateBinding IsLoading}" />
|
||||
IsLoading="{TemplateBinding (u:IconButton.IsLoading)}"
|
||||
IsVisible="{TemplateBinding (u:IconButton.IsLoading)}" />
|
||||
</Panel>
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
@@ -163,7 +165,24 @@
|
||||
</ReversibleStackPanel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<ControlTheme x:Key="BaseIconButton" TargetType="ContentControl">
|
||||
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource ButtonDefaultHeight}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
|
||||
<Setter Property="FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
|
||||
<Setter Property="RenderTransform" Value="none" />
|
||||
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{TemplateBinding Background}" />
|
||||
@@ -247,10 +266,8 @@
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme
|
||||
x:Key="SolidIconButton"
|
||||
BasedOn="{StaticResource {x:Type u:IconButton}}"
|
||||
TargetType="u:IconButton">
|
||||
<ControlTheme x:Key="BaseSolidIconButton" TargetType="ContentControl" BasedOn="{StaticResource BaseIconButton}">
|
||||
<!-- Copy to IconToggleButton:checked -->
|
||||
<Setter Property="FocusAdorner">
|
||||
<FocusAdornerTemplate>
|
||||
<Border Theme="{DynamicResource AdornerLayerBorder}"
|
||||
@@ -378,7 +395,6 @@
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Colorful">
|
||||
<Style Selector="^.Primary">
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
@@ -413,7 +429,6 @@
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidDisabledForeground}" />
|
||||
</Style>
|
||||
@@ -423,10 +438,8 @@
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme
|
||||
x:Key="OutlineIconButton"
|
||||
BasedOn="{StaticResource {x:Type u:IconButton}}"
|
||||
TargetType="u:IconButton">
|
||||
<ControlTheme x:Key="BaseOutlineIconButton" TargetType="ContentControl" BasedOn="{StaticResource BaseIconButton}">
|
||||
<!-- Copy to IconToggleButton:indeterminate -->
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
|
||||
@@ -439,6 +452,7 @@
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Success /template/ Border#PART_Background">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineSuccessBorderBrush}" />
|
||||
</Style>
|
||||
@@ -458,6 +472,7 @@
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
|
||||
</Style>
|
||||
@@ -467,10 +482,7 @@
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme
|
||||
x:Key="BorderlessIconButton"
|
||||
BasedOn="{StaticResource {x:Type u:IconButton}}"
|
||||
TargetType="u:IconButton">
|
||||
<ControlTheme x:Key="BaseBorderlessIconButton" TargetType="ContentControl" BasedOn="{StaticResource BaseIconButton}">
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
|
||||
@@ -483,4 +495,18 @@
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:IconButton}" TargetType="u:IconButton" BasedOn="{StaticResource BaseIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="SolidIconButton" TargetType="u:IconButton" BasedOn="{StaticResource BaseSolidIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="OutlineIconButton" TargetType="u:IconButton" BasedOn="{StaticResource BaseOutlineIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="BorderlessIconButton" TargetType="u:IconButton" BasedOn="{StaticResource BaseBorderlessIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
94
src/Ursa.Themes.Semi/Controls/IconDropDownButton.axaml
Normal file
94
src/Ursa.Themes.Semi/Controls/IconDropDownButton.axaml
Normal file
@@ -0,0 +1,94 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:converters="using:Ursa.Themes.Semi.Converters">
|
||||
|
||||
<ControlTemplate x:Key="IconDropDownButtonTemplate" TargetType="ContentControl">
|
||||
<Border
|
||||
Name="PART_Background"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid
|
||||
ColumnDefinitions="*, Auto"
|
||||
ColumnSpacing="{StaticResource IconButtonInnerSpacing}">
|
||||
<ReversibleStackPanel
|
||||
Name="{x:Static u:IconButton.PART_RootPanel}"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Orientation="Horizontal"
|
||||
Spacing="{StaticResource IconButtonInnerSpacing}">
|
||||
<Panel Name="PART_IconRoot">
|
||||
<Panel.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.Or}">
|
||||
<Binding Path="(u:IconButton.IsLoading)" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
<Binding Path="(u:IconButton.Icon)" RelativeSource="{RelativeSource TemplatedParent}"
|
||||
Converter="{x:Static ObjectConverters.IsNotNull}" />
|
||||
</MultiBinding>
|
||||
</Panel.IsVisible>
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding (u:IconButton.Icon)}"
|
||||
ContentTemplate="{TemplateBinding (u:IconButton.IconTemplate)}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Foreground="{Binding #PART_ContentPresenter.Foreground}"
|
||||
Opacity="{Binding !(u:IconButton.IsLoading), RelativeSource={RelativeSource TemplatedParent}, Converter={converters:BooleansToOpacityConverter}}">
|
||||
<ContentPresenter.DataTemplates>
|
||||
<DataTemplate DataType="Geometry">
|
||||
<PathIcon
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
Data="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ContentPresenter.DataTemplates>
|
||||
</ContentPresenter>
|
||||
<u:LoadingIcon
|
||||
Classes="Small"
|
||||
Foreground="{Binding #PART_ContentPresenter.Foreground}"
|
||||
IsLoading="{TemplateBinding (u:IconButton.IsLoading)}"
|
||||
IsVisible="{TemplateBinding (u:IconButton.IsLoading)}" />
|
||||
</Panel>
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}"
|
||||
TextElement.FontWeight="{TemplateBinding FontWeight}"
|
||||
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
UseLayoutRounding="False" />
|
||||
</ReversibleStackPanel>
|
||||
<PathIcon
|
||||
Name="DropDownGlyph"
|
||||
Grid.Column="1"
|
||||
Theme="{DynamicResource InnerPathIcon}"
|
||||
HorizontalAlignment="Right"
|
||||
Data="{DynamicResource DropDownButtonIconGlyph}"
|
||||
Foreground="{Binding #PART_ContentPresenter.Foreground}"
|
||||
IsHitTestVisible="False"
|
||||
UseLayoutRounding="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:IconDropDownButton}" TargetType="u:IconDropDownButton" BasedOn="{StaticResource BaseIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconDropDownButtonTemplate}" />
|
||||
<Style Selector="^:empty-content">
|
||||
<Setter Property="MinWidth" Value="0" />
|
||||
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="SolidIconDropDownButton" TargetType="u:IconDropDownButton" BasedOn="{StaticResource BaseSolidIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconDropDownButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="OutlineIconDropDownButton" TargetType="u:IconDropDownButton" BasedOn="{StaticResource BaseOutlineIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconDropDownButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="BorderlessIconDropDownButton" TargetType="u:IconDropDownButton" BasedOn="{StaticResource BaseBorderlessIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconDropDownButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
19
src/Ursa.Themes.Semi/Controls/IconRepeatButton.axaml
Normal file
19
src/Ursa.Themes.Semi/Controls/IconRepeatButton.axaml
Normal file
@@ -0,0 +1,19 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:IconRepeatButton}" TargetType="u:IconRepeatButton" BasedOn="{StaticResource BaseIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="SolidIconRepeatButton" TargetType="u:IconRepeatButton" BasedOn="{StaticResource BaseSolidIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="OutlineIconRepeatButton" TargetType="u:IconRepeatButton" BasedOn="{StaticResource BaseOutlineIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="BorderlessIconRepeatButton" TargetType="u:IconRepeatButton" BasedOn="{StaticResource BaseBorderlessIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
81
src/Ursa.Themes.Semi/Controls/IconSplitButton.axaml
Normal file
81
src/Ursa.Themes.Semi/Controls/IconSplitButton.axaml
Normal file
@@ -0,0 +1,81 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
|
||||
<ControlTemplate x:Key="IconSplitButtonTemplate" TargetType="SplitButton">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition MinWidth="{DynamicResource SplitButtonSeparatorWidth}" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<u:IconButton
|
||||
x:Name="PART_PrimaryButton"
|
||||
Grid.Column="0"
|
||||
iri:ClassHelper.ClassSource="{TemplateBinding}"
|
||||
IsEnabled="{TemplateBinding IsEnabled}"
|
||||
Icon="{TemplateBinding (u:IconButton.Icon)}"
|
||||
IconPlacement="{TemplateBinding (u:IconButton.IconPlacement)}"
|
||||
IconTemplate="{TemplateBinding (u:IconButton.IconTemplate)}"
|
||||
IsLoading="{TemplateBinding (u:IconButton.IsLoading)}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Command="{TemplateBinding Command}"
|
||||
CommandParameter="{TemplateBinding CommandParameter}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}" />
|
||||
<u:IconButton
|
||||
x:Name="PART_SecondaryButton"
|
||||
Grid.Column="2"
|
||||
iri:ClassHelper.ClassSource="{TemplateBinding}"
|
||||
VerticalAlignment="Stretch"
|
||||
IsEnabled="{TemplateBinding IsEnabled}"
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Right}}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Theme="{DynamicResource InnerPathIcon}"
|
||||
Data="{DynamicResource SplitButtonIconGlyph}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:IconSplitButton}" TargetType="u:IconSplitButton" BasedOn="{StaticResource BaseIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconSplitButtonTemplate}" />
|
||||
<Style Selector="^ /template/ u|IconButton">
|
||||
<Setter Property="Theme" Value="{StaticResource {x:Type u:IconButton}}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="SolidIconSplitButton" TargetType="u:IconSplitButton" BasedOn="{StaticResource {x:Type u:IconSplitButton}}">
|
||||
<Setter Property="Template" Value="{StaticResource IconSplitButtonTemplate}" />
|
||||
<Style Selector="^ /template/ u|IconButton">
|
||||
<Setter Property="Theme" Value="{StaticResource SolidIconButton}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="OutlineIconSplitButton" TargetType="u:IconSplitButton" BasedOn="{StaticResource {x:Type u:IconSplitButton}}">
|
||||
<Setter Property="Template" Value="{StaticResource IconSplitButtonTemplate}" />
|
||||
<Style Selector="^ /template/ u|IconButton">
|
||||
<Setter Property="Theme" Value="{StaticResource OutlineIconButton}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="BorderlessIconSplitButton" TargetType="u:IconSplitButton" BasedOn="{StaticResource {x:Type u:IconSplitButton}}">
|
||||
<Setter Property="Template" Value="{StaticResource IconSplitButtonTemplate}" />
|
||||
<Style Selector="^ /template/ u|IconButton">
|
||||
<Setter Property="Theme" Value="{StaticResource BorderlessIconButton}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
236
src/Ursa.Themes.Semi/Controls/IconToggleButton.axaml
Normal file
236
src/Ursa.Themes.Semi/Controls/IconToggleButton.axaml
Normal file
@@ -0,0 +1,236 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:IconToggleButton}" TargetType="u:IconToggleButton" BasedOn="{StaticResource BaseIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconButtonTemplate}" />
|
||||
|
||||
<Style Selector="^:checked">
|
||||
<!-- Copy of IconButton.BaseSolidIconButton -->
|
||||
<Setter Property="FocusAdorner">
|
||||
<FocusAdornerTemplate>
|
||||
<Border Theme="{DynamicResource AdornerLayerBorder}"
|
||||
Classes="Solid" />
|
||||
</FocusAdornerTemplate>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
|
||||
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidPrimaryPressedForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPressedBorderBrush}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Primary">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidPrimaryPressedForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Secondary">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Tertiary">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidTertiaryBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidTertiaryPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidTertiaryPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Success">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSuccessBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSuccessPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSuccessPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Warning">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidWarningBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidWarningBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidWarningPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidWarningPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidWarningPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidWarningPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Danger">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidDangerBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidDangerPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidDangerPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerPressedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Colorful">
|
||||
<Style Selector="^.Primary">
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidColorfulPrimaryBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidColorfulPrimaryBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidColorfulPrimaryPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidColorfulPrimaryPointeroverBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidColorfulPrimaryPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidColorfulPrimaryPressedBackground}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Tertiary">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidColorfulTertiaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidColorfulTertiaryBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidColorfulTertiaryBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidColorfulTertiaryPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidColorfulTertiaryPointeroverBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidColorfulTertiaryPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidColorfulTertiaryPressedBackground}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidDisabledForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^:disabled /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDisabledBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:indeterminate">
|
||||
<!-- Copy of IconButton.BaseOutlineIconButton; Update with resources from ToggleButton:indeterminate -->
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Primary /template/ Border#PART_Background">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^.Secondary /template/ Border#PART_Background">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSecondaryIndeterminateBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^.Tertiary /template/ Border#PART_Background">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonTertiaryIndeterminateBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^.Success /template/ Border#PART_Background">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineSuccessBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^.Warning /template/ Border#PART_Background">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineWarningBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^.Danger /template/ Border#PART_Background">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineDangerBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^.Colorful">
|
||||
<Style Selector="^.Primary">
|
||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonOutlineColorfulPrimaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Border#PART_Background">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineColorfulPrimaryBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^:disabled /template/ Border#PART_Background">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
47
src/Ursa.Themes.Semi/Controls/IconToggleSplitButton.axaml
Normal file
47
src/Ursa.Themes.Semi/Controls/IconToggleSplitButton.axaml
Normal file
@@ -0,0 +1,47 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:IconToggleSplitButton}" TargetType="u:IconToggleSplitButton" BasedOn="{StaticResource BaseIconButton}">
|
||||
<Setter Property="Template" Value="{StaticResource IconSplitButtonTemplate}" />
|
||||
<Style Selector="^:not(:checked) /template/ u|IconButton">
|
||||
<Setter Property="Theme" Value="{StaticResource {x:Type u:IconButton}}" />
|
||||
<Style Selector="^#PART_SecondaryButton">
|
||||
<Style Selector="^.Primary">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Secondary">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultSecondaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Tertiary">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Success">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultSuccessForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Warning">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultWarningForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Danger">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDangerForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^.Colorful">
|
||||
<Style Selector="^.Primary">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultColorfulPrimaryForeground}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:checked /template/ u|IconButton">
|
||||
<Setter Property="Theme" Value="{StaticResource SolidIconButton}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:indeterminate /template/ u|IconButton">
|
||||
<Setter Property="Theme" Value="{StaticResource OutlineIconButton}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -23,6 +23,11 @@
|
||||
<ResourceInclude Source="EnumSelector.axaml" />
|
||||
<ResourceInclude Source="Form.axaml" />
|
||||
<ResourceInclude Source="IconButton.axaml" />
|
||||
<ResourceInclude Source="IconDropDownButton.axaml" />
|
||||
<ResourceInclude Source="IconRepeatButton.axaml" />
|
||||
<ResourceInclude Source="IconSplitButton.axaml" />
|
||||
<ResourceInclude Source="IconToggleButton.axaml" />
|
||||
<ResourceInclude Source="IconToggleSplitButton.axaml" />
|
||||
<ResourceInclude Source="ImageViewer.axaml" />
|
||||
<ResourceInclude Source="IPv4Box.axaml" />
|
||||
<ResourceInclude Source="KeyGestureInput.axaml" />
|
||||
|
||||
21
src/Ursa/Common/ReversibleStackPanelUtils.cs
Normal file
21
src/Ursa/Common/ReversibleStackPanelUtils.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
|
||||
namespace Ursa.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Workaround for <see cref="ReversibleStackPanel"/> lacking <see cref="Layoutable.AffectsArrange"/> call
|
||||
/// on <see cref="ReversibleStackPanel.ReverseOrderProperty"/> property.
|
||||
/// Remove this workaround when the bug in Avalonia is fixed.
|
||||
/// </summary>
|
||||
internal class ReversibleStackPanelUtils : Layoutable
|
||||
{
|
||||
private static int _isBugFixed = 0;
|
||||
|
||||
public static void EnsureBugFixed()
|
||||
{
|
||||
if (Interlocked.CompareExchange(ref _isBugFixed, 1, 0) != 0)
|
||||
return;
|
||||
AffectsArrange<ReversibleStackPanel>(ReversibleStackPanel.ReverseOrderProperty);
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,12 @@ public class IconButton : Button
|
||||
public const string PC_EmptyContent = ":empty-content";
|
||||
public const string PART_RootPanel = "PART_RootPanel";
|
||||
|
||||
private Panel? _rootPanel;
|
||||
|
||||
public static readonly StyledProperty<object?> IconProperty =
|
||||
AvaloniaProperty.Register<IconButton, object?>(nameof(Icon));
|
||||
|
||||
public static object? GetIcon(ContentControl o) => o.GetValue(IconProperty);
|
||||
public static void SetIcon(ContentControl o, object? value) => o.SetValue(IconProperty, value);
|
||||
|
||||
public object? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
@@ -33,6 +34,9 @@ public class IconButton : Button
|
||||
public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty =
|
||||
AvaloniaProperty.Register<IconButton, IDataTemplate?>(nameof(IconTemplate));
|
||||
|
||||
public static IDataTemplate? GetIconTemplate(ContentControl o) => o.GetValue(IconTemplateProperty);
|
||||
public static void SetIconTemplate(ContentControl o, IDataTemplate? value) => o.SetValue(IconTemplateProperty, value);
|
||||
|
||||
public IDataTemplate? IconTemplate
|
||||
{
|
||||
get => GetValue(IconTemplateProperty);
|
||||
@@ -42,6 +46,9 @@ public class IconButton : Button
|
||||
public static readonly StyledProperty<bool> IsLoadingProperty =
|
||||
AvaloniaProperty.Register<IconButton, bool>(nameof(IsLoading));
|
||||
|
||||
public static bool GetIsLoading(ContentControl o) => o.GetValue(IsLoadingProperty);
|
||||
public static void SetIsLoading(ContentControl o, bool value) => o.SetValue(IsLoadingProperty, value);
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get => GetValue(IsLoadingProperty);
|
||||
@@ -51,6 +58,9 @@ public class IconButton : Button
|
||||
public static readonly StyledProperty<Position> IconPlacementProperty =
|
||||
AvaloniaProperty.Register<IconButton, Position>(nameof(IconPlacement), defaultValue: Position.Left);
|
||||
|
||||
public static Position GetIconPlacement(ContentControl o) => o.GetValue(IconPlacementProperty);
|
||||
public static void SetIconPlacement(ContentControl o, Position value) => o.SetValue(IconPlacementProperty, value);
|
||||
|
||||
public Position IconPlacement
|
||||
{
|
||||
get => GetValue(IconPlacementProperty);
|
||||
@@ -59,49 +69,48 @@ public class IconButton : Button
|
||||
|
||||
static IconButton()
|
||||
{
|
||||
IconPlacementProperty.Changed.AddClassHandler<IconButton, Position>((o, e) =>
|
||||
ReversibleStackPanelUtils.EnsureBugFixed();
|
||||
IconPlacementProperty.Changed.AddClassHandler<ContentControl, Position>((o, e) =>
|
||||
{
|
||||
o.SetPlacement(e.NewValue.Value, o.Icon);
|
||||
o.InvalidateRootPanel();
|
||||
UpdateIconPseudoClasses(o, e.NewValue.Value, GetIcon(o));
|
||||
});
|
||||
IconProperty.Changed.AddClassHandler<IconButton, object?>((o, e) =>
|
||||
IconProperty.Changed.AddClassHandler<ContentControl, object?>((o, e) =>
|
||||
{
|
||||
o.SetPlacement(o.IconPlacement, e.NewValue.Value);
|
||||
UpdateIconPseudoClasses(o, GetIconPlacement(o), e.NewValue.Value);
|
||||
});
|
||||
ContentProperty.Changed.AddClassHandler<IconButton>((o, e) => o.SetEmptyContent());
|
||||
}
|
||||
|
||||
private void InvalidateRootPanel() => _rootPanel?.InvalidateArrange();
|
||||
|
||||
private void SetEmptyContent()
|
||||
ContentProperty.Changed.AddClassHandler<ContentControl, object?>((o, _) =>
|
||||
{
|
||||
PseudoClasses.Set(PC_EmptyContent, Presenter?.Content is null);
|
||||
UpdateEmptyContentPseudoClass(o);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
_rootPanel = e.NameScope.Find<Panel>(PART_RootPanel);
|
||||
SetEmptyContent();
|
||||
SetPlacement(IconPlacement, Icon);
|
||||
UpdateEmptyContentPseudoClass(this);
|
||||
UpdateIconPseudoClasses(this, IconPlacement, Icon);
|
||||
}
|
||||
|
||||
private void SetPlacement(Position placement, object? icon)
|
||||
internal static void UpdatePseudoClasses(ContentControl button)
|
||||
{
|
||||
if (icon is null)
|
||||
{
|
||||
PseudoClasses.Set(PC_Empty, true);
|
||||
PseudoClasses.Set(PC_Left, false);
|
||||
PseudoClasses.Set(PC_Right, false);
|
||||
PseudoClasses.Set(PC_Top, false);
|
||||
PseudoClasses.Set(PC_Bottom, false);
|
||||
return;
|
||||
UpdateEmptyContentPseudoClass(button);
|
||||
UpdateIconPseudoClasses(button, GetIconPlacement(button), GetIcon(button));
|
||||
}
|
||||
|
||||
PseudoClasses.Set(PC_Empty, false);
|
||||
PseudoClasses.Set(PC_Left, placement == Position.Left);
|
||||
PseudoClasses.Set(PC_Right, placement == Position.Right);
|
||||
PseudoClasses.Set(PC_Top, placement == Position.Top);
|
||||
PseudoClasses.Set(PC_Bottom, placement == Position.Bottom);
|
||||
private static void UpdateEmptyContentPseudoClass(ContentControl button)
|
||||
{
|
||||
IPseudoClasses pseudo = button.Classes;
|
||||
pseudo.Set(PC_EmptyContent, button.Content is null);
|
||||
}
|
||||
|
||||
private static void UpdateIconPseudoClasses(ContentControl button, Position placement, object? icon)
|
||||
{
|
||||
IPseudoClasses pseudo = button.Classes;
|
||||
var hasIcon = icon is not null;
|
||||
pseudo.Set(PC_Empty, !hasIcon);
|
||||
pseudo.Set(PC_Left, hasIcon && placement == Position.Left);
|
||||
pseudo.Set(PC_Right, hasIcon && placement == Position.Right);
|
||||
pseudo.Set(PC_Top, hasIcon && placement == Position.Top);
|
||||
pseudo.Set(PC_Bottom, hasIcon && placement == Position.Bottom);
|
||||
}
|
||||
}
|
||||
57
src/Ursa/Controls/Buttons/IconDropDownButton.cs
Normal file
57
src/Ursa/Controls/Buttons/IconDropDownButton.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
public class IconDropDownButton : DropDownButton
|
||||
{
|
||||
public static readonly StyledProperty<object?> IconProperty =
|
||||
IconButton.IconProperty.AddOwner<IconDropDownButton>();
|
||||
|
||||
public object? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty =
|
||||
IconButton.IconTemplateProperty.AddOwner<IconDropDownButton>();
|
||||
|
||||
public IDataTemplate? IconTemplate
|
||||
{
|
||||
get => GetValue(IconTemplateProperty);
|
||||
set => SetValue(IconTemplateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsLoadingProperty =
|
||||
IconButton.IsLoadingProperty.AddOwner<IconDropDownButton>();
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get => GetValue(IsLoadingProperty);
|
||||
set => SetValue(IsLoadingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<Position> IconPlacementProperty =
|
||||
IconButton.IconPlacementProperty.AddOwner<IconDropDownButton>();
|
||||
|
||||
public Position IconPlacement
|
||||
{
|
||||
get => GetValue(IconPlacementProperty);
|
||||
set => SetValue(IconPlacementProperty, value);
|
||||
}
|
||||
|
||||
static IconDropDownButton()
|
||||
{
|
||||
ReversibleStackPanelUtils.EnsureBugFixed();
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
IconButton.UpdatePseudoClasses(this);
|
||||
}
|
||||
}
|
||||
57
src/Ursa/Controls/Buttons/IconRepeatButton.cs
Normal file
57
src/Ursa/Controls/Buttons/IconRepeatButton.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
public class IconRepeatButton : RepeatButton
|
||||
{
|
||||
public static readonly StyledProperty<object?> IconProperty =
|
||||
IconButton.IconProperty.AddOwner<IconRepeatButton>();
|
||||
|
||||
public object? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty =
|
||||
IconButton.IconTemplateProperty.AddOwner<IconRepeatButton>();
|
||||
|
||||
public IDataTemplate? IconTemplate
|
||||
{
|
||||
get => GetValue(IconTemplateProperty);
|
||||
set => SetValue(IconTemplateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsLoadingProperty =
|
||||
IconButton.IsLoadingProperty.AddOwner<IconRepeatButton>();
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get => GetValue(IsLoadingProperty);
|
||||
set => SetValue(IsLoadingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<Position> IconPlacementProperty =
|
||||
IconButton.IconPlacementProperty.AddOwner<IconRepeatButton>();
|
||||
|
||||
public Position IconPlacement
|
||||
{
|
||||
get => GetValue(IconPlacementProperty);
|
||||
set => SetValue(IconPlacementProperty, value);
|
||||
}
|
||||
|
||||
static IconRepeatButton()
|
||||
{
|
||||
ReversibleStackPanelUtils.EnsureBugFixed();
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
IconButton.UpdatePseudoClasses(this);
|
||||
}
|
||||
}
|
||||
57
src/Ursa/Controls/Buttons/IconSplitButton.cs
Normal file
57
src/Ursa/Controls/Buttons/IconSplitButton.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
public class IconSplitButton : SplitButton
|
||||
{
|
||||
public static readonly StyledProperty<object?> IconProperty =
|
||||
IconButton.IconProperty.AddOwner<IconSplitButton>();
|
||||
|
||||
public object? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty =
|
||||
IconButton.IconTemplateProperty.AddOwner<IconSplitButton>();
|
||||
|
||||
public IDataTemplate? IconTemplate
|
||||
{
|
||||
get => GetValue(IconTemplateProperty);
|
||||
set => SetValue(IconTemplateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsLoadingProperty =
|
||||
IconButton.IsLoadingProperty.AddOwner<IconSplitButton>();
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get => GetValue(IsLoadingProperty);
|
||||
set => SetValue(IsLoadingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<Position> IconPlacementProperty =
|
||||
IconButton.IconPlacementProperty.AddOwner<IconSplitButton>();
|
||||
|
||||
public Position IconPlacement
|
||||
{
|
||||
get => GetValue(IconPlacementProperty);
|
||||
set => SetValue(IconPlacementProperty, value);
|
||||
}
|
||||
|
||||
static IconSplitButton()
|
||||
{
|
||||
ReversibleStackPanelUtils.EnsureBugFixed();
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
IconButton.UpdatePseudoClasses(this);
|
||||
}
|
||||
}
|
||||
56
src/Ursa/Controls/Buttons/IconToggleButton.cs
Normal file
56
src/Ursa/Controls/Buttons/IconToggleButton.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
public class IconToggleButton : ToggleButton
|
||||
{
|
||||
public static readonly StyledProperty<object?> IconProperty =
|
||||
IconButton.IconProperty.AddOwner<IconToggleButton>();
|
||||
|
||||
public object? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty =
|
||||
IconButton.IconTemplateProperty.AddOwner<IconToggleButton>();
|
||||
|
||||
public IDataTemplate? IconTemplate
|
||||
{
|
||||
get => GetValue(IconTemplateProperty);
|
||||
set => SetValue(IconTemplateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsLoadingProperty =
|
||||
IconButton.IsLoadingProperty.AddOwner<IconToggleButton>();
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get => GetValue(IsLoadingProperty);
|
||||
set => SetValue(IsLoadingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<Position> IconPlacementProperty =
|
||||
IconButton.IconPlacementProperty.AddOwner<IconToggleButton>();
|
||||
|
||||
public Position IconPlacement
|
||||
{
|
||||
get => GetValue(IconPlacementProperty);
|
||||
set => SetValue(IconPlacementProperty, value);
|
||||
}
|
||||
|
||||
static IconToggleButton()
|
||||
{
|
||||
ReversibleStackPanelUtils.EnsureBugFixed();
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
IconButton.UpdatePseudoClasses(this);
|
||||
}
|
||||
}
|
||||
59
src/Ursa/Controls/Buttons/IconToggleSplitButton.cs
Normal file
59
src/Ursa/Controls/Buttons/IconToggleSplitButton.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
public class IconToggleSplitButton : ToggleSplitButton
|
||||
{
|
||||
public static readonly StyledProperty<object?> IconProperty =
|
||||
IconButton.IconProperty.AddOwner<IconToggleSplitButton>();
|
||||
|
||||
public object? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty =
|
||||
IconButton.IconTemplateProperty.AddOwner<IconToggleSplitButton>();
|
||||
|
||||
public IDataTemplate? IconTemplate
|
||||
{
|
||||
get => GetValue(IconTemplateProperty);
|
||||
set => SetValue(IconTemplateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsLoadingProperty =
|
||||
IconButton.IsLoadingProperty.AddOwner<IconToggleSplitButton>();
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get => GetValue(IsLoadingProperty);
|
||||
set => SetValue(IsLoadingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<Position> IconPlacementProperty =
|
||||
IconButton.IconPlacementProperty.AddOwner<IconToggleSplitButton>();
|
||||
|
||||
public Position IconPlacement
|
||||
{
|
||||
get => GetValue(IconPlacementProperty);
|
||||
set => SetValue(IconPlacementProperty, value);
|
||||
}
|
||||
|
||||
static IconToggleSplitButton()
|
||||
{
|
||||
ReversibleStackPanelUtils.EnsureBugFixed();
|
||||
}
|
||||
|
||||
protected override Type StyleKeyOverride => GetType();
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
IconButton.UpdatePseudoClasses(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user