Skip to content

Commit dcba0fc

Browse files
committed
Add BannerView
1 parent 8ed2d38 commit dcba0fc

File tree

24 files changed

+13402
-15945
lines changed

24 files changed

+13402
-15945
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ To compile the project, contribute new features, or explore guidelines:
9797
## 🔥 DevWinUI 🔥
9898
### ⚡ What’s Inside? ⚡
9999

100+
- ✨ CycleCollection
100101
- ✨ ContrastAnalyzer
101102
- ✨ ColorAnalyzer
102103
- ✨ SnapLayoutManager
@@ -134,6 +135,7 @@ Install-Package DevWinUI
134135
## 🔥 DevWinUI.Controls 🔥
135136
### ⚡ What’s Inside? ⚡
136137

138+
- ✨ BannerView
137139
- ✨ AudioWave
138140
- ✨ SpectrumVisualizer
139141
- ✨ AnimatedTextBlock
@@ -312,6 +314,9 @@ Install-Package DevWinUI.ContextMenu
312314

313315
## 🕰️ History 🕰️
314316

317+
### BannerView
318+
![BannerView](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/BannerView.gif)
319+
315320
### AudioWave
316321
![AudioWave](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/AudioWave.gif)
317322

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
namespace DevWinUI;
2+
3+
public partial class BannerView
4+
{
5+
public bool IsPerspectiveEnable
6+
{
7+
get { return (bool)GetValue(IsPerspectiveEnableProperty); }
8+
set { SetValue(IsPerspectiveEnableProperty, value); }
9+
}
10+
public static readonly DependencyProperty IsPerspectiveEnableProperty =
11+
DependencyProperty.Register("IsPerspectiveEnable", typeof(bool), typeof(BannerView), new PropertyMetadata(false, (s, a) =>
12+
{
13+
if (a.NewValue != a.OldValue)
14+
{
15+
if (s is BannerView sender)
16+
{
17+
sender.UpdatePerspective();
18+
}
19+
}
20+
}));
21+
22+
public bool IsScaleEnable
23+
{
24+
get { return (bool)GetValue(IsScaleEnableProperty); }
25+
set { SetValue(IsScaleEnableProperty, value); }
26+
}
27+
public static readonly DependencyProperty IsScaleEnableProperty =
28+
DependencyProperty.Register("IsScaleEnable", typeof(bool), typeof(BannerView), new PropertyMetadata(false, (s, a) =>
29+
{
30+
if (a.NewValue != a.OldValue)
31+
{
32+
if (s is BannerView sender)
33+
{
34+
sender.UpdateScale();
35+
}
36+
}
37+
}));
38+
39+
public double ItemsSpacing
40+
{
41+
get { return (double)GetValue(ItemsSpacingProperty); }
42+
set { SetValue(ItemsSpacingProperty, value); }
43+
}
44+
45+
public static readonly DependencyProperty ItemsSpacingProperty =
46+
DependencyProperty.Register("ItemsSpacing", typeof(double), typeof(BannerView), new PropertyMetadata(0d, (s, a) =>
47+
{
48+
if (a.NewValue != a.OldValue)
49+
{
50+
if (s is BannerView sender)
51+
{
52+
sender.UpdateItemSpacing();
53+
}
54+
}
55+
}));
56+
57+
public bool AutoShuffle
58+
{
59+
get { return (bool)GetValue(AutoShuffleProperty); }
60+
set { SetValue(AutoShuffleProperty, value); }
61+
}
62+
63+
public static readonly DependencyProperty AutoShuffleProperty =
64+
DependencyProperty.Register(nameof(AutoShuffle), typeof(bool), typeof(BannerView), new PropertyMetadata(false, OnAutoShuffleChanged));
65+
66+
private static void OnAutoShuffleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
67+
{
68+
var ctl = (BannerView)d;
69+
if (ctl != null)
70+
{
71+
ctl.OnAutoShuffleChanged();
72+
}
73+
}
74+
75+
public TimeSpan Interval
76+
{
77+
get { return (TimeSpan)GetValue(IntervalProperty); }
78+
set { SetValue(IntervalProperty, value); }
79+
}
80+
81+
public static readonly DependencyProperty IntervalProperty =
82+
DependencyProperty.Register(nameof(Interval), typeof(TimeSpan), typeof(BannerView), new PropertyMetadata(TimeSpan.FromSeconds(1), OnIntervalChanged));
83+
84+
private static void OnIntervalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
85+
{
86+
var ctl = (BannerView)d;
87+
if (ctl != null && e.NewValue is TimeSpan timeSpan)
88+
{
89+
ctl.timer?.Interval = timeSpan;
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)