comparison Chronosv2/source/Presentation/Controls/Adorner/TextBlockAdorner.cs @ 10:443821e55f06

Initial cleaned up add from Codeplex files
author stevenh7776 stevenhollidge@hotmail.com
date Tue, 21 Feb 2012 17:25:44 +0700
parents
children
comparison
equal deleted inserted replaced
9:904a9faadf8b 10:443821e55f06
1 using System.Windows;
2 using System.Windows.Controls;
3 using System.Windows.Media;
4
5 namespace Chronos.Presentation.Controls.Adorner
6 {
7 public sealed class TextBlockAdorner
8 : System.Windows.Documents.Adorner
9 {
10 #region · Fields ·
11
12 private readonly TextBlock adornerTextBlock;
13
14 #endregion
15
16 #region · Properties ·
17
18 protected override int VisualChildrenCount
19 {
20 get { return 1; }
21 }
22
23 #endregion
24
25 #region · Constructors ·
26
27 public TextBlockAdorner(UIElement adornedElement, string label, Style labelStyle)
28 : base(adornedElement)
29 {
30 this.adornerTextBlock = new TextBlock { Style = labelStyle, Text = label };
31 }
32
33 #endregion
34
35 #region · Overriden Methods ·
36
37 protected override Size MeasureOverride(Size constraint)
38 {
39 this.adornerTextBlock.Measure(constraint);
40
41 return constraint;
42 }
43
44 protected override Size ArrangeOverride(Size finalSize)
45 {
46 this.adornerTextBlock.Arrange(new Rect(finalSize));
47
48 return finalSize;
49 }
50
51 protected override Visual GetVisualChild(int index)
52 {
53 return this.adornerTextBlock;
54 }
55
56 #endregion
57 }
58 }