|
38
|
1 |
using System; |
|
|
2 |
using System.Net; |
|
|
3 |
using System.Windows; |
|
|
4 |
using System.Windows.Controls; |
|
|
5 |
using System.Windows.Documents; |
|
|
6 |
using System.Windows.Ink; |
|
|
7 |
using System.Windows.Input; |
|
|
8 |
using System.Windows.Media; |
|
|
9 |
using System.Windows.Media.Animation; |
|
|
10 |
using System.Windows.Shapes; |
|
|
11 |
using System.Windows.Controls.Primitives; |
|
|
12 |
namespace Iri.Modernisation.Controls.View |
|
|
13 |
{ |
|
|
14 |
public class ExtendedSlider : Slider |
|
|
15 |
{ |
|
|
16 |
|
|
|
17 |
public ExtendedSlider() |
|
|
18 |
: base() |
|
|
19 |
{ |
|
|
20 |
DefaultStyleKey = typeof(Slider); |
|
|
21 |
} |
|
|
22 |
|
|
|
23 |
/// <summary> |
|
|
24 |
/// Fired when the thumb has been clicked, and dragging is initiated |
|
|
25 |
/// </summary> |
|
|
26 |
public event EventHandler<EventArgs> ThumbDragStarted; |
|
|
27 |
|
|
|
28 |
/// <summary> |
|
|
29 |
/// Fired when the thumb has been released |
|
|
30 |
/// </summary> |
|
|
31 |
public event EventHandler<EventArgs> ThumbDragCompleted; |
|
|
32 |
|
|
|
33 |
|
|
|
34 |
public override void OnApplyTemplate() |
|
|
35 |
{ |
|
|
36 |
base.OnApplyTemplate(); |
|
|
37 |
|
|
|
38 |
//Set up drag event handlers |
|
|
39 |
Thumb thumb = this.GetTemplateChild("HorizontalThumb") as Thumb; |
|
|
40 |
if (thumb != null) |
|
|
41 |
{ |
|
|
42 |
thumb.DragStarted += new DragStartedEventHandler(thumb_DragStarted); |
|
|
43 |
thumb.DragCompleted += new DragCompletedEventHandler(thumb_DragCompleted); |
|
|
44 |
} |
|
|
45 |
} |
|
|
46 |
|
|
|
47 |
void thumb_DragCompleted(object sender, DragCompletedEventArgs e) |
|
|
48 |
{ |
|
|
49 |
OnThumbDragCompleted(this, new EventArgs()); |
|
|
50 |
} |
|
|
51 |
|
|
|
52 |
void thumb_DragStarted(object sender, DragStartedEventArgs e) |
|
|
53 |
{ |
|
|
54 |
OnThumbDragStarted(this, new EventArgs()); |
|
|
55 |
} |
|
|
56 |
|
|
|
57 |
protected virtual void OnThumbDragStarted(object sender, EventArgs e) |
|
|
58 |
{ |
|
|
59 |
if (ThumbDragStarted != null) |
|
|
60 |
ThumbDragStarted(sender, e); |
|
|
61 |
} |
|
|
62 |
|
|
|
63 |
protected virtual void OnThumbDragCompleted(object sender, EventArgs e) |
|
|
64 |
{ |
|
|
65 |
if (ThumbDragCompleted != null) |
|
|
66 |
ThumbDragCompleted(sender, e); |
|
|
67 |
} |
|
|
68 |
} |
|
|
69 |
} |