|
| 1 | +namespace DevWinUI; |
| 2 | + |
| 3 | +public partial class LoopPanel |
| 4 | +{ |
| 5 | + public double Spacing |
| 6 | + { |
| 7 | + get => (double)GetValue(SpacingProperty); |
| 8 | + set => SetValue(SpacingProperty, value); |
| 9 | + } |
| 10 | + public static readonly DependencyProperty SpacingProperty = |
| 11 | + DependencyProperty.Register(nameof(Spacing), typeof(double), typeof(LoopPanel), new PropertyMetadata(0.0, OnSpacingChanged)); |
| 12 | + |
| 13 | + private static void OnSpacingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
| 14 | + { |
| 15 | + if (d is LoopPanel panel) |
| 16 | + { |
| 17 | + panel.InvalidateMeasure(); |
| 18 | + panel.InvalidateArrange(); |
| 19 | + } |
| 20 | + } |
| 21 | + |
| 22 | + public double MouseWheelScrollFactor |
| 23 | + { |
| 24 | + get => (double)GetValue(MouseWheelScrollFactorProperty); |
| 25 | + set => SetValue(MouseWheelScrollFactorProperty, value); |
| 26 | + } |
| 27 | + public static readonly DependencyProperty MouseWheelScrollFactorProperty = |
| 28 | + DependencyProperty.Register(nameof(MouseWheelScrollFactor), typeof(double), typeof(LoopPanel), new PropertyMetadata(0.25)); |
| 29 | + |
| 30 | + public double DragScrollFactor |
| 31 | + { |
| 32 | + get => (double)GetValue(DragScrollFactorProperty); |
| 33 | + set => SetValue(DragScrollFactorProperty, value); |
| 34 | + } |
| 35 | + public static readonly DependencyProperty DragScrollFactorProperty = |
| 36 | + DependencyProperty.Register(nameof(DragScrollFactor), typeof(double), typeof(LoopPanel), new PropertyMetadata(1.0)); |
| 37 | + |
| 38 | + public bool IsInertiaEnabled |
| 39 | + { |
| 40 | + get => (bool)GetValue(IsInertiaEnabledProperty); |
| 41 | + set => SetValue(IsInertiaEnabledProperty, value); |
| 42 | + } |
| 43 | + public static readonly DependencyProperty IsInertiaEnabledProperty = |
| 44 | + DependencyProperty.Register(nameof(IsInertiaEnabled), typeof(bool), typeof(LoopPanel), new PropertyMetadata(true)); |
| 45 | + |
| 46 | + public bool BringChildrenIntoView |
| 47 | + { |
| 48 | + get { return (bool)GetValue(BringChildrenIntoViewProperty); } |
| 49 | + set { SetValue(BringChildrenIntoViewProperty, value); } |
| 50 | + } |
| 51 | + public static readonly DependencyProperty BringChildrenIntoViewProperty = |
| 52 | + DependencyProperty.Register(nameof(BringChildrenIntoView),typeof(bool), typeof(LoopPanel), new PropertyMetadata(false)); |
| 53 | + |
| 54 | + public double Offset |
| 55 | + { |
| 56 | + get { return (double)GetValue(OffsetProperty); } |
| 57 | + set { SetValue(OffsetProperty, value); } |
| 58 | + } |
| 59 | + public static readonly DependencyProperty OffsetProperty = |
| 60 | + DependencyProperty.Register(nameof(Offset), typeof(double), typeof(LoopPanel), new PropertyMetadata(0.5d)); |
| 61 | + |
| 62 | + public Orientation Orientation |
| 63 | + { |
| 64 | + get { return (Orientation)GetValue(OrientationProperty); } |
| 65 | + set { SetValue(OrientationProperty, value); } |
| 66 | + } |
| 67 | + public static readonly DependencyProperty OrientationProperty = |
| 68 | + DependencyProperty.Register(nameof(Orientation), typeof(Orientation),typeof(LoopPanel), new PropertyMetadata(Orientation.Horizontal)); |
| 69 | + |
| 70 | + public double RelativeOffset |
| 71 | + { |
| 72 | + get { return (double)GetValue(RelativeOffsetProperty); } |
| 73 | + set { SetValue(RelativeOffsetProperty, value); } |
| 74 | + } |
| 75 | + |
| 76 | + public static readonly DependencyProperty RelativeOffsetProperty = |
| 77 | + DependencyProperty.Register(nameof(RelativeOffset), typeof(double), typeof(LoopPanel), new PropertyMetadata(0.5d, IsRelativeOffsetValid)); |
| 78 | + |
| 79 | + private static void IsRelativeOffsetValid(DependencyObject d, DependencyPropertyChangedEventArgs e) |
| 80 | + { |
| 81 | + IsRelativeOffsetValid(e.NewValue); |
| 82 | + } |
| 83 | +} |
0 commit comments