feat: Add HoneycombPanel and demo.

This commit is contained in:
NaBian committed 2026-06-13 16:16:48 +08:00
1 parent d1944b01c3
commit e7005d09b5
16 files changed
+263 -1

No files matched your search

@@ -0,0 +1,49 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
x:Class="HandyControlDemo.UserControl.CirclePanelDemo">
<UserControl.Resources>
<ControlTheme x:Key="CirclePanelButton" TargetType="Button">
<Setter Property="UseLayoutRounding" Value="False" />
<Setter Property="Height" Value="77" />
<Setter Property="Width" Value="36.06" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<Panel Width="36.06" Height="77">
<Path Data="{StaticResource CirclePanelDemoGeometry}"
Fill="{DynamicResource PrimaryBrush}"
Stretch="Fill" />
<Path Data="{StaticResource CirclePanelRightGeometry}"
Fill="White"
Stretch="Uniform"
Height="21"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Opacity" Value=".9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity" Value=".6" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Opacity" Value="0.4" />
</Style>
</ControlTheme>
</UserControl.Resources>
<hc:CirclePanel Margin="64" Diameter="170">
<Button Theme="{StaticResource CirclePanelButton}" />
<Button Theme="{StaticResource CirclePanelButton}" />
<Button Theme="{StaticResource CirclePanelButton}" />
<Button Theme="{StaticResource CirclePanelButton}" />
<Button Theme="{StaticResource CirclePanelButton}" />
<Button Theme="{StaticResource CirclePanelButton}" />
<Button Theme="{StaticResource CirclePanelButton}" />
<Button Theme="{StaticResource CirclePanelButton}" />
</hc:CirclePanel>
</UserControl>
@@ -0,0 +1,9 @@
namespace HandyControlDemo.UserControl;
public partial class CirclePanelDemo : Avalonia.Controls.UserControl
{
public CirclePanelDemo()
{
InitializeComponent();
}
}
@@ -0,0 +1,40 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:vm="clr-namespace:HandyControlDemo.ViewModel"
x:Class="HandyControlDemo.UserControl.HoneycombPanelDemo"
DataContext="{Binding HoneycombPanelDemo, Source={x:Static vm:ViewModelLocator.Instance}}">
<Grid Margin="32">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal"
Spacing="8"
Margin="0,0,0,16">
<Button Command="{Binding AddItemCommand}" Content="Add" />
<Button Command="{Binding RemoveItemCommand}" Content="Remove" />
</StackPanel>
<ItemsControl Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ItemsSource="{Binding DataList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<hc:HoneycombPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Width="60"
Height="60"
Margin="6"
CornerRadius="30"
ClipToBounds="True">
<Image Source="{Binding}" Stretch="UniformToFill" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</UserControl>
@@ -0,0 +1,9 @@
namespace HandyControlDemo.UserControl;
public partial class HoneycombPanelDemo : Avalonia.Controls.UserControl
{
public HoneycombPanelDemo()
{
InitializeComponent();
}
}
@@ -0,0 +1,132 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
x:Class="HandyControlDemo.UserControl.WaterfallPanelDemo">
<Grid Margin="32">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<NumericUpDown x:Name="UpDownGroups"
HorizontalAlignment="Center"
Value="2"
Minimum="1"
Maximum="3"
Width="200"
Theme="{StaticResource NumericUpDownExtend}"
hc:TitleElement.Title="Groups"
hc:TitleElement.TitleWidth="50"
hc:TitleElement.TitlePlacement="Left"/>
<hc:UniformSpacingPanel Grid.Row="1"
Spacing="16"
ChildWrapping="Wrap"
Margin="0,16,0,0">
<ScrollViewer MaxHeight="300">
<hc:WaterfallPanel VerticalAlignment="Center"
Width="300"
Groups="{Binding #UpDownGroups.Value}">
<Border Height="100"
Background="{DynamicResource PrimaryBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
<Border Height="140"
Background="{DynamicResource DangerBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
<Border Height="100"
Background="{DynamicResource SuccessBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
<Border Height="170"
Background="{DynamicResource InfoBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
<Border Height="100"
Background="{DynamicResource WarningBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
</hc:WaterfallPanel>
</ScrollViewer>
<ScrollViewer HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Hidden"
hc:ScrollViewerAttach.Orientation="Horizontal"
MaxWidth="300">
<hc:WaterfallPanel VerticalAlignment="Center"
Height="300"
Orientation="Vertical"
Groups="{Binding #UpDownGroups.Value}">
<Border Width="100"
Background="{DynamicResource PrimaryBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
<Border Width="140"
Background="{DynamicResource DangerBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
<Border Width="100"
Background="{DynamicResource SuccessBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
<Border Width="170"
Background="{DynamicResource InfoBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
<Border Width="100"
Background="{DynamicResource WarningBrush}"
Effect="{StaticResource EffectShadow1}"
Margin="5">
<TextBlock Text="Content"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="White"/>
</Border>
</hc:WaterfallPanel>
</ScrollViewer>
</hc:UniformSpacingPanel>
</Grid>
</UserControl>
@@ -0,0 +1,9 @@
namespace HandyControlDemo.UserControl;
public partial class WaterfallPanelDemo : Avalonia.Controls.UserControl
{
public WaterfallPanelDemo()
{
InitializeComponent();
}
}