How To Minimize Automation effort on controls which are tested against WPF attribute "visible" or "enabled" with parameter "true" or "false"

There is a bunch of controls, e.g. 16 pieces. They are located on one page of the UI, the order is like a Matrix.
They have AutomationId glued, also the Window has an AutomationId so that the controls can be found easiyl.

The WPFP controls are configured with Attributes to enable/disable or show/hide them with extra steering buttons.

First approach in a TestSuite could be (maximum of entries in Ranorex repo for XPathes)

I too like the data driven approach as you can also validate against the expected visible state. There is a less optimal approach and may not even work for your scenario, but if you only care about finding the objects and then performing actions upon it, you could just make your path more generic:

.//form[@automationid='Test']/button[@automationid='CommandButton2'] //We do not care if it is visible or not
.//form[@automationid='Test']/button[@automationid='CommandButton2' and @visible='False' or @visible='True] //Essentially the same thing as above since visible is a boolean

then once you find the object, you can validate it. As mentioned before, I would recommend doing the data driven approach because it allows you to easily validate the expected state.