-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathTabAssist.cs
More file actions
101 lines (73 loc) · 4.72 KB
/
TabAssist.cs
File metadata and controls
101 lines (73 loc) · 4.72 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
namespace MaterialDesignThemes.Wpf;
public enum TabControlHeaderBehavior
{
Scrolling,
Wrapping
}
public static class TabAssist
{
public static readonly DependencyProperty HasFilledTabProperty = DependencyProperty.RegisterAttached(
"HasFilledTab", typeof(bool), typeof(TabAssist), new PropertyMetadata(false));
public static void SetHasFilledTab(DependencyObject element, bool value)
=> element.SetValue(HasFilledTabProperty, value);
public static bool GetHasFilledTab(DependencyObject element)
=> (bool)element.GetValue(HasFilledTabProperty);
public static readonly DependencyProperty HasUniformTabWidthProperty = DependencyProperty.RegisterAttached(
"HasUniformTabWidth", typeof(bool), typeof(TabAssist), new PropertyMetadata(false));
public static void SetHasUniformTabWidth(DependencyObject element, bool value)
=> element.SetValue(HasUniformTabWidthProperty, value);
public static bool GetHasUniformTabWidth(DependencyObject element)
=> (bool)element.GetValue(HasUniformTabWidthProperty);
public static readonly DependencyProperty HeaderPanelMarginProperty = DependencyProperty.RegisterAttached(
"HeaderPanelMargin", typeof(Thickness), typeof(TabAssist), new PropertyMetadata(default(Thickness)));
public static void SetHeaderPanelMargin(DependencyObject element, Thickness value)
=> element.SetValue(HeaderPanelMarginProperty, value);
public static Thickness GetHeaderPanelMargin(DependencyObject element)
=> (Thickness)element.GetValue(HeaderPanelMarginProperty);
public static Visibility GetBindableIsItemsHost(DependencyObject obj)
=> (Visibility)obj.GetValue(BindableIsItemsHostProperty);
public static void SetBindableIsItemsHost(DependencyObject obj, Visibility value)
=> obj.SetValue(BindableIsItemsHostProperty, value);
public static readonly DependencyProperty BindableIsItemsHostProperty =
DependencyProperty.RegisterAttached("BindableIsItemsHost", typeof(Visibility), typeof(TabAssist), new PropertyMetadata(Visibility.Collapsed, OnBindableIsItemsHostChanged));
private static void OnBindableIsItemsHostChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is Panel panel)
{
panel.IsItemsHost = (Visibility)e.NewValue == Visibility.Visible;
}
}
public static Cursor GetTabHeaderCursor(DependencyObject obj)
=> (Cursor)obj.GetValue(TabHeaderCursorProperty);
public static void SetTabHeaderCursor(DependencyObject obj, Cursor value)
=> obj.SetValue(TabHeaderCursorProperty, value);
public static readonly DependencyProperty TabHeaderCursorProperty =
DependencyProperty.RegisterAttached("TabHeaderCursor", typeof(Cursor), typeof(TabAssist), new PropertyMetadata(Cursors.Hand));
public static TabControlHeaderBehavior GetHeaderBehavior(DependencyObject obj)
=> (TabControlHeaderBehavior)obj.GetValue(HeaderBehaviorProperty);
public static void SetHeaderBehavior(DependencyObject obj, TabControlHeaderBehavior value)
=> obj.SetValue(HeaderBehaviorProperty, value);
public static readonly DependencyProperty HeaderBehaviorProperty =
DependencyProperty.RegisterAttached("HeaderBehavior", typeof(TabControlHeaderBehavior), typeof(TabAssist),
new PropertyMetadata(TabControlHeaderBehavior.Scrolling));
public static double GetHeaderPadding(DependencyObject obj)
=> (double)obj.GetValue(HeaderPaddingProperty);
public static bool GetUseHeaderPadding(DependencyObject obj)
=> (bool)obj.GetValue(UseHeaderPaddingProperty);
public static void SetUseHeaderPadding(DependencyObject obj, bool value)
=> obj.SetValue(UseHeaderPaddingProperty, value);
public static readonly DependencyProperty UseHeaderPaddingProperty =
DependencyProperty.RegisterAttached("UseHeaderPadding", typeof(bool), typeof(TabAssist), new PropertyMetadata(false));
public static void SetHeaderPadding(DependencyObject obj, double value)
=> obj.SetValue(HeaderPaddingProperty, value);
public static readonly DependencyProperty HeaderPaddingProperty =
DependencyProperty.RegisterAttached("HeaderPadding", typeof(double),
typeof(TabAssist), new PropertyMetadata(0d));
public static TimeSpan GetScrollDuration(DependencyObject obj)
=> (TimeSpan)obj.GetValue(ScrollDurationProperty);
public static void SetScrollDuration(DependencyObject obj, TimeSpan value)
=> obj.SetValue(ScrollDurationProperty, value);
public static readonly DependencyProperty ScrollDurationProperty =
DependencyProperty.RegisterAttached("ScrollDuration", typeof(TimeSpan),
typeof(TabAssist), new PropertyMetadata(TimeSpan.Zero));
}