comparison Messaging/Common/Controls/MetroTile.cs @ 36:c8c79f05d76f

WORKING VERSION! HIGH FIVE!
author adminsh@apollo
date Tue, 27 Mar 2012 18:33:44 +0100
parents 83c1f62d9370
children
comparison
equal deleted inserted replaced
35:83c1f62d9370 36:c8c79f05d76f
1 using System; 1 using System.ComponentModel;
2 using System.Windows; 2 using System.Windows;
3 using System.Windows.Controls; 3 using System.Windows.Controls;
4 using System.Windows.Input; 4 using System.Windows.Input;
5 using System.Windows.Media; 5 using System.Windows.Media;
6 using System.Windows.Media.Imaging;
7 6
8 namespace Common.Controls 7 namespace Common.Controls
9 { 8 {
10 [TemplatePart(Name="PART_DISPLAY_ICON", Type=typeof(Image))] 9 [TemplatePart(Name="PART_DISPLAY_ICON", Type=typeof(Image))]
11 [TemplatePart(Name = "PART_DISPLAY_COUNT_CONTAINER", Type = typeof(TextBlock))] 10 [TemplatePart(Name = "PART_DISPLAY_COUNT_CONTAINER", Type = typeof(TextBlock))]
12 [TemplatePart(Name = "PART_DISPLAY_TITLE_CONTAINER", Type = typeof(TextBlock))] 11 [TemplatePart(Name = "PART_DISPLAY_TITLE_CONTAINER", Type = typeof(TextBlock))]
13 public class MetroTile : UserControl 12 [Description("Represents a metro styled tile that displays an icon, a count and a title")]
13 public class MetroTile : Control
14 { 14 {
15
16 #region Constructor 15 #region Constructor
17 16
18 static MetroTile() 17 static MetroTile()
19 { 18 {
20 DefaultStyleKeyProperty.OverrideMetadata(typeof(MetroTile), 19 DefaultStyleKeyProperty.OverrideMetadata(typeof(MetroTile),
29 28
30 #region Dependency Properties 29 #region Dependency Properties
31 30
32 #region DisplayIcon 31 #region DisplayIcon
33 32
34 /// <summary>
35 /// Icon for the tile
36 /// </summary>
37 public static readonly DependencyProperty DisplayIconProperty = 33 public static readonly DependencyProperty DisplayIconProperty =
38 DependencyProperty.Register("DisplayIcon", 34 DependencyProperty.Register("DisplayIcon",
39 typeof(Image), 35 typeof (ImageSource),
40 typeof(MetroTile), 36 typeof (MetroTile),
41 new PropertyMetadata(null)); 37 new PropertyMetadata(null));
42 38
43 public Image DisplayIcon 39 [Description("The icon displayed in the tile."), Category("Common Properties")]
40 public ImageSource DisplayIcon
44 { 41 {
45 get { return (Image) this.GetValue(DisplayIconProperty); } 42 get { return (ImageSource)this.GetValue(DisplayIconProperty); }
46 set { this.SetValue(DisplayIconProperty, value); } 43 set { this.SetValue(DisplayIconProperty, value); }
47 } 44 }
45
48 #endregion 46 #endregion
49 47
50 #region DisplayCount 48 #region DisplayCount
51 49
52 /// <summary>
53 /// Display count for the tile
54 /// </summary>
55 public static readonly DependencyProperty DisplayCountProperty = 50 public static readonly DependencyProperty DisplayCountProperty =
56 DependencyProperty.Register("DisplayCount", 51 DependencyProperty.Register("DisplayCount",
57 typeof(int), 52 typeof(int),
58 typeof(MetroTile), 53 typeof(MetroTile),
59 new UIPropertyMetadata(0)); 54 new UIPropertyMetadata(0));
60 55
56 [Description("The count displayed in the tile."), Category("Common Properties")]
61 public int DisplayCount 57 public int DisplayCount
62 { 58 {
63 get { return (int)this.GetValue(DisplayCountProperty); } 59 get { return (int)this.GetValue(DisplayCountProperty); }
64 set { this.SetValue(DisplayCountProperty, value); } 60 set { this.SetValue(DisplayCountProperty, value); }
65 } 61 }
66 62
67 #endregion 63 #endregion
68 64
69 #region DisplayText 65 #region DisplayText
70 66
71 /// <summary> 67 [Description("The text displayed in the tile."), Category("Common Properties")]
72 /// Main Display text for the tile
73 /// </summary>
74 public static readonly DependencyProperty DisplayTextProperty = 68 public static readonly DependencyProperty DisplayTextProperty =
75 DependencyProperty.Register("DisplayText", 69 DependencyProperty.Register("DisplayText",
76 typeof(string), 70 typeof(string),
77 typeof(MetroTile), 71 typeof(MetroTile),
78 new PropertyMetadata("Not set")); 72 new PropertyMetadata("Not set"));