Skip to content

Commit f9016e5

Browse files
committed
Initial property for MediaSlideshow
1 parent ae56c01 commit f9016e5

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Microsoft.UI.Xaml;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
6+
namespace BackgroundTest.CustomControl.MediaSlideshow;
7+
8+
public partial class MediaSlideshow
9+
{
10+
#region Events
11+
12+
private static void MediaItems_OnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
13+
{
14+
throw new NotImplementedException();
15+
}
16+
17+
#endregion
18+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
using Microsoft.UI.Xaml;
2+
using System;
3+
using System.IO;
4+
using Windows.Storage.Streams;
5+
6+
namespace BackgroundTest.CustomControl.MediaSlideshow;
7+
8+
public partial class MediaSlideshow
9+
{
10+
#region Properties
11+
12+
/// <summary>
13+
/// List of media sources. This can be in forms of <see cref="Uri"/>, <see cref="string"/> (Either for URL or Local Path), <see cref="Stream"/> or <see cref="IRandomAccessStream"/>.
14+
/// </summary>
15+
public ManagedObservableList<object> MediaItems
16+
{
17+
get => (ManagedObservableList<object>)GetValue(MediaItemsProperty);
18+
set => SetValue(MediaItemsProperty, value);
19+
}
20+
21+
/// <summary>
22+
/// The index of current media being displayed.
23+
/// </summary>
24+
public int CurrentMediaIndex
25+
{
26+
get => (int)GetValue(CurrentMediaIndexProperty);
27+
set => SetValue(CurrentMediaIndexProperty, value);
28+
}
29+
30+
/// <summary>
31+
/// Determine how long the duration for the slideshow to switch into the next media.
32+
/// </summary>
33+
public double SlideshowDuration
34+
{
35+
get => (double)GetValue(SlideshowDurationProperty);
36+
set => SetValue(SlideshowDurationProperty, value);
37+
}
38+
39+
/// <summary>
40+
/// Override <see cref="SlideshowDuration"/> and use video's own duration instead.
41+
/// </summary>
42+
public bool OverrideSlideshowDurationOnVideo
43+
{
44+
get => (bool)GetValue(OverrideSlideshowDurationOnVideoProperty);
45+
set => SetValue(OverrideSlideshowDurationOnVideoProperty, value);
46+
}
47+
48+
/// <summary>
49+
/// Enable parallax effect on the media canvas.
50+
/// </summary>
51+
public bool EnableParallaxEffect
52+
{
53+
get => (bool)GetValue(EnableParallaxEffectProperty);
54+
set => SetValue(EnableParallaxEffectProperty, value);
55+
}
56+
57+
#endregion
58+
59+
#region Dependency Properties
60+
61+
public static readonly DependencyProperty MediaItemsProperty =
62+
DependencyProperty.Register(nameof(MediaItems), typeof(ManagedObservableList<object>), typeof(MediaSlideshow),
63+
new PropertyMetadata(new ManagedObservableList<object>(), MediaItems_OnChanged));
64+
65+
public static readonly DependencyProperty CurrentMediaIndexProperty =
66+
DependencyProperty.Register(nameof(CurrentMediaIndex), typeof(int), typeof(MediaSlideshow),
67+
new PropertyMetadata(0));
68+
69+
public static readonly DependencyProperty SlideshowDurationProperty =
70+
DependencyProperty.Register(nameof(SlideshowDuration), typeof(double), typeof(MediaSlideshow),
71+
new PropertyMetadata(0));
72+
73+
public static readonly DependencyProperty OverrideSlideshowDurationOnVideoProperty =
74+
DependencyProperty.Register(nameof(OverrideSlideshowDurationOnVideo), typeof(bool), typeof(MediaSlideshow),
75+
new PropertyMetadata(true));
76+
77+
public static readonly DependencyProperty EnableParallaxEffectProperty =
78+
DependencyProperty.Register(nameof(EnableParallaxEffect), typeof(bool), typeof(MediaSlideshow),
79+
new PropertyMetadata(false));
80+
81+
#endregion
82+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using Microsoft.UI.Xaml.Controls;
2+
3+
namespace BackgroundTest.CustomControl.MediaSlideshow;
4+
5+
public partial class MediaSlideshow : Control;

0 commit comments

Comments
 (0)