How to set AutomationId for CloseButton for Panels?
Close Panel Button
Answers approved by DevExpress Support
Hello,
To accomplish this task, you can create an additional attached property for your LayoutPanel, find the "PART_CloseButton" element according to the following article and bind the corresponding AutomationId property to your attached property: How to modify DX themes in WPF.
Thanks,
Kirill
That is OK. Not sure if it worked correctly. Found some strange AutomationId. Please look at my video.
Tried yours solution with mine MVVM code and not worked. Sth must have done wrong. Attached code and solution. Please take a look.
Thank you for providing the modified sample. As I can see, the AutomationProperties.AutomationId property is set correctly on your side. The issue occurs because of the ControlBoxButtonPresenterAutomationPeer implementation - it ignores the AutomationProperties.AutomationId property value. Our developers will fix this issue. In order not to overload this thread, I have created a separate report about this problem - ControlBoxButtonPresenter - The AutomationProperties.AutomationId property value is ignored.
As a quick fix, you can replace ControlBoxButtonPresenter with a custom descendant - see the attached sample.