0

There is a WinForms application, the application is supposed to be covered by automated tests. I'm struggling with setting value to items of a PropertyGrid. I've successfully found an AutomationElement of the PropertyGrid and its AutomationElement children. Now I have an AutomationElement of a PropertyGrid item. When I ask for supported patterns it returns zero patterns. But it returns no pattern only when there is no value set to a PropertyGrid item. When there is value set to the PropertyGrid item then it returns ValuePattern.

My first question is: What should I or app developers do to be able to get ValuePattern no matter if there is no value set on PropertyGrid item? I've done some research and found out that you can add IValueProvider to Custom UI Controls, but it seems PropertyGrid is a black box and it's not possible to modify it.

The second question is: Why I'm able to set a value to a PropertyGrid item via Inspect even while PropertyGrid item has no value. How Inspec is able to set a value without using ValuePattern?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.