RegularItemsControl.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Windows;
  2. using HandyControl.Data;
  3. namespace HandyControl.Controls;
  4. /// <summary>
  5. /// 规则ItemsControl
  6. /// </summary>
  7. /// <remarks>
  8. /// 该类的每一项都具有相同的大小和外边距
  9. /// </remarks>
  10. public class RegularItemsControl : SimpleItemsControl
  11. {
  12. public static readonly DependencyProperty ItemWidthProperty = DependencyProperty.Register(
  13. nameof(ItemWidth), typeof(double), typeof(RegularItemsControl), new PropertyMetadata(ValueBoxes.Double200Box));
  14. public double ItemWidth
  15. {
  16. get => (double) GetValue(ItemWidthProperty);
  17. set => SetValue(ItemWidthProperty, value);
  18. }
  19. public static readonly DependencyProperty ItemHeightProperty = DependencyProperty.Register(
  20. nameof(ItemHeight), typeof(double), typeof(RegularItemsControl), new PropertyMetadata(ValueBoxes.Double200Box));
  21. public double ItemHeight
  22. {
  23. get => (double) GetValue(ItemHeightProperty);
  24. set => SetValue(ItemHeightProperty, value);
  25. }
  26. public static readonly DependencyProperty ItemMarginProperty = DependencyProperty.Register(
  27. nameof(ItemMargin), typeof(Thickness), typeof(RegularItemsControl), new PropertyMetadata(default(Thickness)));
  28. public Thickness ItemMargin
  29. {
  30. get => (Thickness) GetValue(ItemMarginProperty);
  31. set => SetValue(ItemMarginProperty, value);
  32. }
  33. }