2 * AutomationProperties.cs.
5 * Moonlight List (moonlight-list@lists.ximian.com)
7 * Copyright 2008 Novell, Inc. (http://www.novell.com)
9 * See the LICENSE file included with the distribution for details.
15 namespace System
.Windows
.Automation
17 public static class AutomationProperties
19 public static readonly DependencyProperty AcceleratorKeyProperty
20 = DependencyProperty
.RegisterAttachedCore ("AcceleratorKey", typeof (string), typeof (AutomationProperties
),
21 new PropertyMetadata (null, new PropertyChangedCallback (AcceleratorKeyChanged
)));
22 public static readonly DependencyProperty AccessKeyProperty
23 = DependencyProperty
.RegisterAttachedCore ("AccessKey", typeof (string), typeof (AutomationProperties
),
24 new PropertyMetadata (null, new PropertyChangedCallback (AccessKeyChanged
)));
25 public static readonly DependencyProperty AutomationIdProperty
26 = DependencyProperty
.RegisterAttachedCore ("AutomationId", typeof (string), typeof (AutomationProperties
),
27 new PropertyMetadata (null, new PropertyChangedCallback (AutomationIdChanged
)));
28 public static readonly DependencyProperty HelpTextProperty
29 = DependencyProperty
.RegisterAttachedCore ("HelpText", typeof (string), typeof (AutomationProperties
),
30 new PropertyMetadata (null, new PropertyChangedCallback (HelpTextChanged
)));
31 public static readonly DependencyProperty IsRequiredForFormProperty
32 = DependencyProperty
.RegisterAttachedCore ("IsRequiredForForm", typeof (bool), typeof (AutomationProperties
),
33 new PropertyMetadata (false, new PropertyChangedCallback (IsRequiredForFormChanged
)));
34 public static readonly DependencyProperty ItemStatusProperty
35 = DependencyProperty
.RegisterAttachedCore ("ItemStatus", typeof (string), typeof (AutomationProperties
),
36 new PropertyMetadata (null, new PropertyChangedCallback (ItemStatusChanged
)));
37 public static readonly DependencyProperty ItemTypeProperty
38 = DependencyProperty
.RegisterAttachedCore ("ItemType", typeof (string), typeof (AutomationProperties
),
39 new PropertyMetadata (null, new PropertyChangedCallback (ItemTypeChanged
)));
40 public static readonly DependencyProperty LabeledByProperty
41 = DependencyProperty
.RegisterAttachedCore ("LabeledBy", typeof (UIElement
), typeof (AutomationProperties
),
42 new PropertyMetadata (null, new PropertyChangedCallback (LabeledByChanged
)));
43 public static readonly DependencyProperty NameProperty
44 = DependencyProperty
.RegisterAttachedCore ("Name", typeof (string), typeof (AutomationProperties
),
45 new PropertyMetadata (null, new PropertyChangedCallback (NameChanged
)));
47 public static string GetAcceleratorKey(DependencyObject element
)
49 return (string) element
.GetValue (AutomationProperties
.AcceleratorKeyProperty
);
52 public static string GetAccessKey(DependencyObject element
)
54 return (string) element
.GetValue (AutomationProperties
.AccessKeyProperty
);
57 public static string GetAutomationId(DependencyObject element
)
59 return (string) element
.GetValue (AutomationProperties
.AutomationIdProperty
);
62 public static string GetHelpText(DependencyObject element
)
64 return (string) element
.GetValue (AutomationProperties
.HelpTextProperty
);
67 public static bool GetIsRequiredForForm(DependencyObject element
)
69 return (bool) element
.GetValue (AutomationProperties
.IsRequiredForFormProperty
);
72 public static string GetItemStatus(DependencyObject element
)
74 return (string) element
.GetValue (AutomationProperties
.ItemStatusProperty
);
77 public static string GetItemType(DependencyObject element
)
79 return (string) element
.GetValue (AutomationProperties
.ItemTypeProperty
);
82 public static UIElement
GetLabeledBy(DependencyObject element
)
84 return (UIElement
) element
.GetValue (AutomationProperties
.LabeledByProperty
);
87 public static string GetName(DependencyObject element
)
89 return (string) element
.GetValue (AutomationProperties
.NameProperty
);
92 public static void SetAcceleratorKey(DependencyObject element
, string value)
94 element
.SetValue (AutomationProperties
.AcceleratorKeyProperty
, value);
97 public static void SetAccessKey(DependencyObject element
, string value)
99 element
.SetValue (AutomationProperties
.AccessKeyProperty
, value);
102 public static void SetAutomationId(DependencyObject element
, string value)
104 element
.SetValue (AutomationProperties
.AutomationIdProperty
, value);
107 public static void SetHelpText(DependencyObject element
, string value)
109 element
.SetValue (AutomationProperties
.HelpTextProperty
, value);
112 public static void SetIsRequiredForForm(DependencyObject element
, bool value)
114 element
.SetValue (AutomationProperties
.IsRequiredForFormProperty
, value);
117 public static void SetItemStatus(DependencyObject element
, string value)
119 element
.SetValue (AutomationProperties
.ItemStatusProperty
, value);
122 public static void SetItemType(DependencyObject element
, string value)
124 element
.SetValue (AutomationProperties
.ItemTypeProperty
, value);
127 public static void SetLabeledBy(DependencyObject element
, UIElement
value)
129 element
.SetValue (AutomationProperties
.LabeledByProperty
, value);
132 public static void SetName(DependencyObject element
, string value)
134 element
.SetValue (AutomationProperties
.NameProperty
, value);
137 #region UIA internal events
139 static void AcceleratorKeyChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
141 (sender
as FrameworkElement
).RaiseAcceleratorKeyChanged (args
);
144 static void AccessKeyChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
146 (sender
as FrameworkElement
).RaiseAccessKeyChanged (args
);
149 static void AutomationIdChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
151 (sender
as FrameworkElement
).RaiseAutomationIdChanged (args
);
154 static void HelpTextChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
156 (sender
as FrameworkElement
).RaiseHelpTextChanged (args
);
159 static void IsRequiredForFormChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
161 (sender
as FrameworkElement
).RaiseIsRequiredForFormChanged (args
);
164 static void ItemStatusChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
166 (sender
as FrameworkElement
).RaiseItemStatusChanged (args
);
169 static void ItemTypeChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
171 (sender
as FrameworkElement
).RaiseItemTypeChanged (args
);
174 static void LabeledByChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
176 (sender
as FrameworkElement
).RaiseLabeledByChanged (args
);
179 static void NameChanged (DependencyObject sender
, DependencyPropertyChangedEventArgs args
)
181 (sender
as FrameworkElement
).RaiseNameChanged (args
);