Blame view

sources/RoboforkApp/Adorners/ResizeAdorner.cs 1.03 KB
729be9a6d   doan   New Project
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
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Documents;
  using System.Windows.Media;
  
  namespace RoboforkApp
  {
      public class ResizeAdorner : Adorner
      {
          private VisualCollection visuals;
          private ResizeChrome chrome;
  
          protected override int VisualChildrenCount
          {
              get
              {
                  return this.visuals.Count;
              }
          }
  
          public ResizeAdorner(ContentControl designerItem)
              : base(designerItem)
          {
              this.chrome = new ResizeChrome();            
              this.visuals = new VisualCollection(this);
              this.visuals.Add(this.chrome);
              this.chrome.DataContext = designerItem;
          }
  
          protected override Size ArrangeOverride(Size arrangeBounds)
          {
              this.chrome.Arrange(new Rect(arrangeBounds));
              return arrangeBounds;
          }
  
          protected override Visual GetVisualChild(int index)
          {
              return this.visuals[index];
          }
      }
  }