Selecting WPF Checkbox

In this article, we will see how to select WPF Checkbox using TogglePattern class which is available in UI Automation pattern.



Once the above code is executed, “Show only bargains” checkbox will be checked. This “SelectCheckbox” function will check the checkbox if it is already unchecked and vice versa. So it is always recommended to make sure whether the checkbox is checked or not using the “ToggleState” property before calling the function. The ToggleState property for the object can be retrieved as given below.

This implementation for the checkbox is as same as selecting a radio button but the only difference is Toggle Pattern is used for Checkbox.

Leave a Reply

Your email address will not be published. Required fields are marked *