-
Notifications
You must be signed in to change notification settings - Fork 6
/
TreeViewService.cs
79 lines (68 loc) · 2.59 KB
/
TreeViewService.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
75
76
77
78
79
namespace PresentationTheme.Aero
{
using System.Windows;
using System.Windows.Controls;
/// <summary>
/// Provides attached options for the <see cref="TreeView"/> control.
/// </summary>
public static class TreeViewService
{
#region public int ItemLevel { get; set; }
/// <summary>
/// Identifies the ItemLevel read-only attached dependency property
/// key.
/// </summary>
private static readonly DependencyPropertyKey ItemLevelPropertyKey =
DependencyProperty.RegisterAttachedReadOnly(
"ItemLevel",
typeof(int),
typeof(TreeViewService),
new PropertyMetadata(0));
/// <summary>
/// Identifies the ItemLevel read-only attached dependency property.
/// </summary>
public static readonly DependencyProperty ItemLevelProperty =
ItemLevelPropertyKey.DependencyProperty;
/// <summary>Gets the item level.</summary>
public static int GetItemLevel(DependencyObject d)
{
return (int)d.GetValue(ItemLevelProperty);
}
/// <summary>Sets the item level.</summary>
internal static void SetItemLevel(DependencyObject d, int value)
{
d.SetValue(ItemLevelPropertyKey, value);
}
#endregion
#region public bool FullRowSelect { get; set; }
/// <summary>
/// Identifies the FullRowSelect attached dependency property.
/// </summary>
public static readonly DependencyProperty FullRowSelectProperty =
DependencyProperty.RegisterAttached(
"FullRowSelect",
typeof(bool),
typeof(TreeViewService),
new FrameworkPropertyMetadata(
false,
FrameworkPropertyMetadataOptions.AffectsMeasure |
FrameworkPropertyMetadataOptions.Inherits));
/// <summary>
/// Gets a flag indicating whether a <see cref="TreeView"/> style
/// should use full-row selection if supported.
/// </summary>
public static bool GetFullRowSelect(TreeView d)
{
return (bool)d.GetValue(FullRowSelectProperty);
}
/// <summary>
/// Sets a flag indicating whether a <see cref="TreeView"/> style
/// should use full-row selection if supported.
/// </summary>
public static void SetFullRowSelect(TreeView d, bool value)
{
d.SetValue(FullRowSelectProperty, value);
}
#endregion
}
}