Skip to content

Commit 5ffa514

Browse files
committed
Add LoopPanel
1 parent faf959a commit 5ffa514

10 files changed

Lines changed: 855 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ Install-Package DevWinUI
135135
## 🔥 DevWinUI.Controls 🔥
136136
### ⚡ What’s Inside? ⚡
137137

138+
- ✨ LoopPanel
138139
- ✨ CarouselView2
139140
- ✨ CoverFlow
140141
- ✨ ContentSlider
@@ -320,6 +321,9 @@ Install-Package DevWinUI.ContextMenu
320321

321322
## 🕰️ History 🕰️
322323

324+
### LoopPanel
325+
![LoopPanel](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/LoopPanel.gif)
326+
323327
### CarouselView2
324328
![CarouselView2](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/CarouselView2.gif)
325329
![CarouselView2](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/CarouselView22.gif)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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

Comments
 (0)