I need to focus XamMaskedEditor through Automation.
I have an XamMaskedEditor with AutomationID="xme1".
AutomationElement xme1 = library.GetElement(mainWindow, AutomationElement.AutomationIdProperty, "xme1", TreeScope.Descendants);xme1.SetFocus();While executing the second statement, an exception is thrown.The target element cannot receive focus. at MS.Internal.Automation.ElementUtil.Invoke(AutomationPeer peer, DispatcherOperationCallback work, Object arg)Call Stack:> UIAutomationClient.dll!MS.Internal.Automation.UiaCoreApi.CheckError(int hr) Line 1223 C# UIAutomationClient.dll!System.Windows.Automation.AutomationElement.SetFocus() Line 916 + 0x21 bytes C# CalculatorTest.exe!CalculatorTest.TestCalc.StartTest() Line 26 + 0xa bytes C# CalculatorTest.exe!CalculatorTest.Program.Main(string[] args) Line 14 + 0x1d bytes C#Please help me with this issue.
Hi,
It seems that this is a bug in our control.
For now you can use SetFocuc() method inside try catch block. Looking for your reply if this workaround works for you.
Regards,
Anastas
We are using version 11.2. Please provide a workaround in 11.2 if this issue is fixed for 12.1 as we are not in a position to upgrade the existing project to 12.1. I haven't tested for 12.1.
Could you please tell us which version you are using(it seems like: 12.1.1010).
Looking for your reply.