-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance: Optimized the ScrollViewer style.
- Loading branch information
Showing
16 changed files
with
458 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Nullable>enable</Nullable> | ||
<AvaloniaVersion>11.0.6</AvaloniaVersion> | ||
<AvaloniaVersion>11.1.1</AvaloniaVersion> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/RepeatButtonDemoCtl.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:Class="HandyControlDemo.UserControl.RepeatButtonDemoCtl" | ||
xmlns:hc="https://handyorg.github.io/handycontrol" | ||
Background="{DynamicResource RegionBrush}"> | ||
<ScrollViewer> | ||
<hc:UniformSpacingPanel ChildWrapping="Wrap" | ||
Spacing="32" | ||
Margin="32"> | ||
<hc:UniformSpacingPanel Orientation="Vertical" | ||
Spacing="32"> | ||
<WrapPanel> | ||
<StackPanel> | ||
<RepeatButton Content="default" | ||
Margin="5" /> | ||
<RepeatButton IsEnabled="False" | ||
Content="default" | ||
Margin="5" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<RepeatButton Content="primary" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonPrimary}" /> | ||
<RepeatButton IsEnabled="False" | ||
Content="primary" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonPrimary}" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<RepeatButton Content="success" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonSuccess}" /> | ||
<RepeatButton IsEnabled="False" | ||
Content="success" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonSuccess}" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<RepeatButton Content="info" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonInfo}" /> | ||
<RepeatButton IsEnabled="False" | ||
Content="info" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonInfo}" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<RepeatButton Content="warning" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonWarning}" /> | ||
<RepeatButton IsEnabled="False" | ||
Content="warning" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonWarning}" /> | ||
</StackPanel> | ||
<StackPanel> | ||
<RepeatButton Content="danger" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonDanger}" /> | ||
<RepeatButton IsEnabled="False" | ||
Content="danger" | ||
Margin="5" | ||
Theme="{StaticResource RepeatButtonDanger}" /> | ||
</StackPanel> | ||
</WrapPanel> | ||
</hc:UniformSpacingPanel> | ||
</hc:UniformSpacingPanel> | ||
</ScrollViewer> | ||
</UserControl> |
9 changes: 9 additions & 0 deletions
9
src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/RepeatButtonDemoCtl.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace HandyControlDemo.UserControl; | ||
|
||
public partial class RepeatButtonDemoCtl : Avalonia.Controls.UserControl | ||
{ | ||
public RepeatButtonDemoCtl() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
src/Avalonia/HandyControl_Avalonia/Themes/Styles/RepeatButton.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
<ControlTheme x:Key="RepeatButtonBaseStyle" | ||
TargetType="RepeatButton"> | ||
<Setter Property="Height" | ||
Value="{StaticResource DefaultControlHeight}" /> | ||
<Setter Property="Padding" | ||
Value="{StaticResource DefaultControlPadding}" /> | ||
<Setter Property="HorizontalAlignment" | ||
Value="Center" /> | ||
<Setter Property="VerticalAlignment" | ||
Value="Center" /> | ||
<Setter Property="HorizontalContentAlignment" | ||
Value="Center" /> | ||
<Setter Property="VerticalContentAlignment" | ||
Value="Center" /> | ||
<Setter Property="Background" | ||
Value="{DynamicResource RegionBrush}" /> | ||
<Setter Property="Foreground" | ||
Value="{DynamicResource TextIconBrush}" /> | ||
<Setter Property="BorderBrush" | ||
Value="{DynamicResource BorderBrush}" /> | ||
<Setter Property="BorderThickness" | ||
Value="1" /> | ||
<Setter Property="CornerRadius" | ||
Value="{StaticResource DefaultCornerRadius}" /> | ||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<ContentPresenter x:Name="PART_ContentPresenter" | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{TemplateBinding CornerRadius}" | ||
Content="{TemplateBinding Content}" | ||
ContentTemplate="{TemplateBinding ContentTemplate}" | ||
Padding="{TemplateBinding Padding}" | ||
RecognizesAccessKey="True" | ||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> | ||
</ControlTemplate> | ||
</Setter> | ||
|
||
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter"> | ||
<Setter Property="Opacity" | ||
Value="0.9" /> | ||
</Style> | ||
|
||
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter"> | ||
<Setter Property="Opacity" | ||
Value="0.6" /> | ||
</Style> | ||
|
||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter"> | ||
<Setter Property="Opacity" | ||
Value="0.4" /> | ||
</Style> | ||
</ControlTheme> | ||
|
||
<ControlTheme x:Key="RepeatButtonDefault" | ||
BasedOn="{StaticResource RepeatButtonBaseStyle}" | ||
TargetType="RepeatButton"> | ||
<Setter Property="Foreground" | ||
Value="{DynamicResource PrimaryTextBrush}" /> | ||
|
||
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter"> | ||
<Setter Property="Background" | ||
Value="{DynamicResource SecondaryRegionBrush}" /> | ||
</Style> | ||
|
||
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter"> | ||
<Setter Property="Background" | ||
Value="{DynamicResource BorderBrush}" /> | ||
</Style> | ||
</ControlTheme> | ||
|
||
<ControlTheme x:Key="{x:Type RepeatButton}" | ||
BasedOn="{StaticResource RepeatButtonDefault}" | ||
TargetType="RepeatButton" /> | ||
|
||
<ControlTheme x:Key="RepeatButtonPrimary" | ||
BasedOn="{StaticResource RepeatButtonBaseStyle}" | ||
TargetType="RepeatButton"> | ||
<Setter Property="Background" | ||
Value="{DynamicResource PrimaryBrush}" /> | ||
<Setter Property="BorderBrush" | ||
Value="{DynamicResource PrimaryBrush}" /> | ||
</ControlTheme> | ||
|
||
<ControlTheme x:Key="RepeatButtonSuccess" | ||
BasedOn="{StaticResource RepeatButtonBaseStyle}" | ||
TargetType="RepeatButton"> | ||
<Setter Property="Background" | ||
Value="{DynamicResource SuccessBrush}" /> | ||
<Setter Property="BorderBrush" | ||
Value="{DynamicResource SuccessBrush}" /> | ||
</ControlTheme> | ||
|
||
<ControlTheme x:Key="RepeatButtonInfo" | ||
BasedOn="{StaticResource RepeatButtonBaseStyle}" | ||
TargetType="RepeatButton"> | ||
<Setter Property="Background" | ||
Value="{DynamicResource InfoBrush}" /> | ||
<Setter Property="BorderBrush" | ||
Value="{DynamicResource InfoBrush}" /> | ||
</ControlTheme> | ||
|
||
<ControlTheme x:Key="RepeatButtonWarning" | ||
BasedOn="{StaticResource RepeatButtonBaseStyle}" | ||
TargetType="RepeatButton"> | ||
<Setter Property="Background" | ||
Value="{DynamicResource WarningBrush}" /> | ||
<Setter Property="BorderBrush" | ||
Value="{DynamicResource WarningBrush}" /> | ||
</ControlTheme> | ||
|
||
<ControlTheme x:Key="RepeatButtonDanger" | ||
BasedOn="{StaticResource RepeatButtonBaseStyle}" | ||
TargetType="RepeatButton"> | ||
<Setter Property="Background" | ||
Value="{DynamicResource DangerBrush}" /> | ||
<Setter Property="BorderBrush" | ||
Value="{DynamicResource DangerBrush}" /> | ||
</ControlTheme> | ||
</ResourceDictionary> |
Oops, something went wrong.