add ShowEmpty prop for Empty control

This commit is contained in:
NaBian 2021-01-31 23:42:40 +08:00
parent cabd4bd12e
commit 378af385e4
4 changed files with 19 additions and 1 deletions

View File

@ -8232,6 +8232,7 @@
<Setter Property="Description" Value="{StaticResource DescriptionTextBlock4Empty}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Visibility" Value="{Binding Path=(hc:Empty.ShowEmpty),RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:Empty">

View File

@ -1,5 +1,6 @@
using System.Windows;
using System.Windows.Controls;
using HandyControl.Data;
namespace HandyControl.Controls
{
@ -22,5 +23,14 @@ namespace HandyControl.Controls
get => GetValue(LogoProperty);
set => SetValue(LogoProperty, value);
}
public static readonly DependencyProperty ShowEmptyProperty = DependencyProperty.RegisterAttached(
"ShowEmpty", typeof(bool), typeof(Empty), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits));
public static void SetShowEmpty(DependencyObject element, bool value)
=> element.SetValue(ShowEmptyProperty, value);
public static bool GetShowEmpty(DependencyObject element)
=> (bool) element.GetValue(ShowEmptyProperty);
}
}

View File

@ -3,7 +3,12 @@
xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
xmlns:ex="clr-namespace:HandyControl.Tools.Extension"
xmlns:o="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:hc="clr-namespace:HandyControl.Controls">
xmlns:hc="clr-namespace:HandyControl.Controls"
xmlns:themes="clr-namespace:HandyControl.Themes">
<ResourceDictionary.MergedDictionaries>
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Converters.xaml"/>
</ResourceDictionary.MergedDictionaries>
<DrawingBrush x:Key="EmptySimpleLogo" o:Freeze="True">
<DrawingBrush.Drawing>
@ -24,6 +29,7 @@
<Setter Property="Description" Value="{StaticResource DescriptionTextBlock4Empty}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Visibility" Value="{Binding Path=(hc:Empty.ShowEmpty),RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:Empty">

View File

@ -8350,6 +8350,7 @@
<Setter Property="Description" Value="{StaticResource DescriptionTextBlock4Empty}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Visibility" Value="{Binding Path=(hc:Empty.ShowEmpty),RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:Empty">