How can I get to the value of my WPF UserControl DependencyProperty from UI Automation Framework?

Posted by Surfbutler on Stack Overflow See other posts from Stack Overflow or by Surfbutler
Published on 2010-03-09T15:22:48Z Indexed on 2010/03/12 12:37 UTC
Read the original article Hit count: 296

Hi, I'm having trouble getting access to my WPF UserControl DependencyProperty values through the UI Automation Framework.

I've used James McCaffreys article in MSDN as a starting point (Automating IO Tests in WPF Applications, MSDN March 2009), but I can only see properties etc in standard controls such as buttons.

I'm assuming there's some Automation interface I have to implement on my UserControl, but what and how?

I can already see my control fine e.g. in UISpy, but I can't see the dependency properties within it. Here's what my usercontrol looks like currently in UISpy:

AutomationElement General Accessibility AccessKey: "" AcceleratorKey: "" IsKeyboardFocusable: "False" LabeledBy: "(null)" HelpText: "Switches 48v Phantom Power On/Off (for Mic inputs only)."

State IsEnabled: "True" HasKeyboardFocus: "False"

Identification ClassName: "" ControlType: "ControlType.Custom" Culture: "(null)" AutomationId: "V48SwL" LocalizedControlType: "custom" Name: "" ProcessId: "5684 (VirtualSix)" RuntimeId: "7 5684 40026340" IsPassword: "False" IsControlElement: "True" IsContentElement: "True"

Visibility BoundingRectangle: "(140, 457, 31, 20)" ClickablePoint: "155,467" IsOffscreen: "False"

ControlPatterns

© Stack Overflow or respective owner

Related posts about wpf

Related posts about usercontrols