-
Notifications
You must be signed in to change notification settings - Fork 324
/
LayoutGridResizerControl.cs
74 lines (58 loc) · 3.36 KB
/
LayoutGridResizerControl.cs
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
64
65
66
67
68
69
70
71
72
73
74
/************************************************************************
AvalonDock
Copyright (C) 2007-2013 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Public
License (Ms-PL) as published at https://opensource.org/licenses/MS-PL
************************************************************************/
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
namespace AvalonDock.Controls
{
/// <inheritdoc />
/// <summary>Implements a control like <see cref="System.Windows.Controls.GridSplitter"/> that can be used to resize areas
/// horizontally or vertically (only one of these but never both) in a grid layout.</summary>
/// <seealso cref="Thumb"/>
public class LayoutGridResizerControl : Thumb
{
#region Constructors
static LayoutGridResizerControl()
{
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
//This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(typeof(LayoutGridResizerControl)));
HorizontalAlignmentProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
VerticalAlignmentProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(VerticalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
BackgroundProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(Brushes.Transparent));
IsHitTestVisibleProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(true, null));
}
#endregion Constructors
#region Properties
#region BackgroundWhileDragging
/// <summary><see cref="BackgroundWhileDragging"/> dependency property.</summary>
public static readonly DependencyProperty BackgroundWhileDraggingProperty = DependencyProperty.Register(nameof(BackgroundWhileDragging), typeof(Brush), typeof(LayoutGridResizerControl),
new FrameworkPropertyMetadata(Brushes.Black));
/// <summary>Gets/sets the background brush of the control being dragged.</summary>
[Bindable(true), Description("Gets/sets the background brush of the control being dragged."), Category("Other")]
public Brush BackgroundWhileDragging
{
get => (Brush)GetValue(BackgroundWhileDraggingProperty);
set => SetValue(BackgroundWhileDraggingProperty, value);
}
#endregion BackgroundWhileDragging
#region OpacityWhileDragging
/// <summary><see cref="OpacityWhileDragging"/> dependency property.</summary>
public static readonly DependencyProperty OpacityWhileDraggingProperty = DependencyProperty.Register(nameof(OpacityWhileDragging), typeof(double), typeof(LayoutGridResizerControl),
new FrameworkPropertyMetadata(0.5));
/// <summary>Gets/sets the opacity while the control is being dragged.</summary>
[Bindable(true), Description("Gets/sets the opacity while the control is being dragged."), Category("Other")]
public double OpacityWhileDragging
{
get => (double)GetValue(OpacityWhileDraggingProperty);
set => SetValue(OpacityWhileDraggingProperty, value);
}
#endregion OpacityWhileDragging
#endregion Properties
}
}