-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTimeLineItem.cs
More file actions
63 lines (53 loc) · 2.01 KB
/
Copy pathTimeLineItem.cs
File metadata and controls
63 lines (53 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Whathecode.System.Windows.DependencyPropertyFactory;
using Whathecode.System.Windows.DependencyPropertyFactory.Attributes;
namespace Whathecode.TimeLine
{
public class TimeLineItem : Control
{
public enum Properties
{
Occurance,
Fill,
Stroke,
StrokeThickness
}
static readonly Type Type = typeof( TimeLineItem );
public static readonly DependencyPropertyFactory<Properties> PropertyFactory = new DependencyPropertyFactory<Properties>();
public static readonly DependencyProperty OccuranceProperty = PropertyFactory[ Properties.Occurance ];
public static readonly DependencyProperty FillProperty = PropertyFactory[ Properties.Fill ];
public static readonly DependencyProperty StrokeProperty = PropertyFactory[ Properties.Stroke ];
public static readonly DependencyProperty StrokeThicknessProperty = PropertyFactory[ Properties.StrokeThickness ];
[DependencyProperty( Properties.Occurance )]
public DateTime Occurance
{
get { return (DateTime)PropertyFactory.GetValue( this, Properties.Occurance ); }
set { PropertyFactory.SetValue( this, Properties.Occurance, value ); }
}
[DependencyProperty( Properties.Fill )]
public Brush Fill
{
get { return (Brush)PropertyFactory.GetValue( this, Properties.Fill ); }
set { PropertyFactory.SetValue( this, Properties.Fill, value ); }
}
[DependencyProperty( Properties.Stroke )]
public Brush Stroke
{
get { return (Brush)PropertyFactory.GetValue( this, Properties.Stroke ); }
set { PropertyFactory.SetValue( this, Properties.Stroke, value ); }
}
[DependencyProperty( Properties.StrokeThickness )]
public double StrokeThickness
{
get { return (double)PropertyFactory.GetValue( this, Properties.StrokeThickness ); }
set { PropertyFactory.SetValue( this, Properties.StrokeThickness, value ); }
}
static TimeLineItem()
{
DefaultStyleKeyProperty.OverrideMetadata( Type, new FrameworkPropertyMetadata( Type ) );
}
}
}