Empty.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using HandyControl.Data;
  4. namespace HandyControl.Controls;
  5. public class Empty : ContentControl
  6. {
  7. public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register(
  8. nameof(Description), typeof(object), typeof(Empty), new PropertyMetadata(default(object)));
  9. public object Description
  10. {
  11. get => GetValue(DescriptionProperty);
  12. set => SetValue(DescriptionProperty, value);
  13. }
  14. public static readonly DependencyProperty LogoProperty = DependencyProperty.Register(
  15. nameof(Logo), typeof(object), typeof(Empty), new PropertyMetadata(default(object)));
  16. public object Logo
  17. {
  18. get => GetValue(LogoProperty);
  19. set => SetValue(LogoProperty, value);
  20. }
  21. public static readonly DependencyProperty ShowEmptyProperty = DependencyProperty.RegisterAttached(
  22. "ShowEmpty", typeof(bool), typeof(Empty), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits));
  23. public static void SetShowEmpty(DependencyObject element, bool value)
  24. => element.SetValue(ShowEmptyProperty, ValueBoxes.BooleanBox(value));
  25. public static bool GetShowEmpty(DependencyObject element)
  26. => (bool) element.GetValue(ShowEmptyProperty);
  27. }