feat: Add Badge styles and demos.
This commit is contained in:
1 parent
4cd78a4b3f
commit
905bc92825
7 files changed
+383
-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.BadgeDemo"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<ScrollViewer>
|
||||
<hc:UniformSpacingPanel Margin="32"
|
||||
Spacing="32"
|
||||
ChildWrapping="Wrap"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center">
|
||||
<hc:Badge Text="New"
|
||||
BadgeMargin="0,-14,-20,0"
|
||||
Height="30">
|
||||
<Button Content="Comment" />
|
||||
</hc:Badge>
|
||||
<hc:Badge Text="New"
|
||||
BadgeMargin="0,-14,-20,0"
|
||||
Height="30"
|
||||
Theme="{StaticResource BadgeDanger}">
|
||||
<Button Content="Comment" />
|
||||
</hc:Badge>
|
||||
<hc:Badge Name="CountBadge"
|
||||
Value="0"
|
||||
BadgeMargin="0,-14,-10,0"
|
||||
Height="30"
|
||||
Theme="{StaticResource BadgePrimary}">
|
||||
<Button Name="CountButton"
|
||||
Content="Click to Count" />
|
||||
</hc:Badge>
|
||||
<hc:Badge Value="100"
|
||||
BadgeMargin="0,-14,-20,0"
|
||||
Height="30"
|
||||
Theme="{StaticResource BadgeDanger}">
|
||||
<Button Content="Comment" />
|
||||
</hc:Badge>
|
||||
<hc:Badge Status="Dot"
|
||||
Height="30"
|
||||
Theme="{StaticResource BadgeDanger}">
|
||||
<Button Content="Reply" />
|
||||
</hc:Badge>
|
||||
<hc:Badge Status="Processing"
|
||||
Height="30"
|
||||
Theme="{StaticResource BadgeDanger}">
|
||||
<Button Content="Reply" />
|
||||
</hc:Badge>
|
||||
</hc:UniformSpacingPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,20 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using HandyControl.Controls;
|
||||
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class BadgeDemo : Avalonia.Controls.UserControl
|
||||
{
|
||||
public BadgeDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var badge = this.FindControl<Badge>("CountBadge");
|
||||
var button = this.FindControl<Button>("CountButton");
|
||||
if (button != null && badge != null)
|
||||
{
|
||||
button.Click += (_, _) => badge.Value += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user