forked from ygoe/MultiSelectTreeView
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElement.cs
More file actions
78 lines (68 loc) · 2.03 KB
/
Copy pathElement.cs
File metadata and controls
78 lines (68 loc) · 2.03 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Automation;
using MultiSelectTreeView.Test.Model.Helper;
namespace MultiSelectTreeView.Test.Model
{
class Element
{
public Element(AutomationElement automationElement)
{
Ae = automationElement;
}
internal AutomationElement Ae { get; private set; }
public void Expand()
{
ExpandCollapsePattern expandPattern = Ae.GetPattern<ExpandCollapsePattern>();
expandPattern.Expand();
}
public void Collapse()
{
ExpandCollapsePattern expandPattern = Ae.GetPattern<ExpandCollapsePattern>();
expandPattern.Collapse();
}
public void Select()
{
SelectionItemPattern pattern = Ae.GetPattern<SelectionItemPattern>();
pattern.Select();
}
public bool IsSelected
{
get
{
SelectionItemPattern pattern = Ae.GetPattern<SelectionItemPattern>();
return pattern.Current.IsSelected;
}
}
public bool IsExpanded
{
get
{
ExpandCollapsePattern pattern = Ae.GetPattern<ExpandCollapsePattern>();
return pattern.Current.ExpandCollapseState == ExpandCollapseState.Expanded;
}
}
public bool IsFocused
{
get
{
return Convert.ToBoolean(GetValue("node;IsFocused"));
}
}
public bool IsSelectedPreview
{
get
{
return Convert.ToBoolean(GetValue("node;IsSelectedPreview"));
}
}
public string GetValue(string id)
{
ValuePattern pattern = Ae.GetPattern<ValuePattern>();
pattern.SetValue(id);
return pattern.Current.Value;
}
}
}