Play an animation when the content of the badge is changed, and add the related demo.

This commit is contained in:
DingpingZhang committed 2019-04-04 21:05:15 +08:00
1 parent bf34643ff4
commit 2fd5d90432
6 files changed
+79 -7

No files matched your search

+1
View File
@@ -364,6 +364,7 @@
<Compile Include="ViewModel\Basic\ChatBoxViewModel.cs" />
<Compile Include="ViewModel\Basic\InteractiveDialogViewModel.cs" />
<Compile Include="ViewModel\Common\ComboBoxDemoViewModel.cs" />
<Compile Include="ViewModel\Controls\BadgeDemoCtlViewModel.cs" />
<Compile Include="ViewModel\Controls\CoverViewModel.cs" />
<Compile Include="ViewModel\Controls\DialogDemoViewModel.cs" />
<Compile Include="ViewModel\Controls\NotifyIconDemoViewModel.cs" />
@@ -3,7 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Background="{DynamicResource RegionBrush}">
Background="{DynamicResource RegionBrush}"
DataContext="{Binding Path=BadgeDemoCtl, Source={StaticResource Locator}}">
<controls:TransitioningContentControl>
<StackPanel Margin="32" Orientation="Horizontal">
<controls:Badge Text="New" BadgeMargin="0,-14,-20,0" Height="30">
@@ -12,8 +13,8 @@
<controls:Badge Text="New" BadgeMargin="0,-14,-20,0" Height="30" Margin="32,0,0,0" Style="{StaticResource BadgeDanger}">
<Button Content="{x:Static langs:Lang.Comment}"/>
</controls:Badge>
<controls:Badge Value="1" Height="30" Margin="32,0,0,0" Style="{StaticResource BadgePrimary}">
<Button Content="{x:Static langs:Lang.Comment}"/>
<controls:Badge Value="{Binding Count}" Height="30" Margin="32,0,0,0" Style="{StaticResource BadgePrimary}">
<Button Content="计数" Command="{Binding CountCommand}"/>
</controls:Badge>
<controls:Badge Value="100" BadgeMargin="0,-14,-20,0" Height="30" Margin="32,0,0,0" Style="{StaticResource BadgeDanger}">
<Button Content="{x:Static langs:Lang.Comment}"/>
@@ -0,0 +1,25 @@
using System.Windows.Input;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
namespace HandyControlDemo.ViewModel.Controls
{
public class BadgeDemoCtlViewModel : ViewModelBase
{
private int _count;
public int Count
{
get => _count;
set => Set(ref _count, value);
}
public ICommand CountCommand { get; }
public BadgeDemoCtlViewModel()
{
Count = 1;
CountCommand = new RelayCommand(() => Count++);
}
}
}
@@ -5,6 +5,7 @@ using GalaSoft.MvvmLight.Ioc;
using HandyControlDemo.Data;
using HandyControlDemo.Service;
using HandyControlDemo.ViewModel.Basic;
using HandyControlDemo.ViewModel.Controls;
namespace HandyControlDemo.ViewModel
{
@@ -31,6 +32,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register<SearchBarDemoViewModel>();
SimpleIoc.Default.Register<NotifyIconDemoViewModel>();
SimpleIoc.Default.Register<InteractiveDialogViewModel>();
SimpleIoc.Default.Register<BadgeDemoCtlViewModel>();
}
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
@@ -67,6 +69,8 @@ namespace HandyControlDemo.ViewModel
public NotifyIconDemoViewModel NotifyIconDemo => ServiceLocator.Current.GetInstance<NotifyIconDemoViewModel>();
public InteractiveDialogViewModel InteractiveDialog => ServiceLocator.Current.GetInstance<InteractiveDialogViewModel>();
public BadgeDemoCtlViewModel BadgeDemoCtl => ServiceLocator.Current.GetInstance<BadgeDemoCtlViewModel>();
#endregion
}
}