Home Forums WPF controls Xceed Toolkit Plus for WPF IntegerUpDown / WatermarkTextbox automation

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • jjacks
    Participant
    Post count: 6
    #45057 |

    Hello,
    We have bought an Xceed license recently and we upgraded from the older free v3.1 to v3.5.

    Unfortunately IntegerUpDown is not automatable anymore – previously we were able to edit value via nested AutoselectTextBox but the newest version uses WatermarkTextBox internally which doesn’t expose any textbox in its automation tree. Its control template is quite abstracted therefore I would appreciate a hint how to automate it.

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi jjacks,

    The IntegerUpDown is built with a WatermarkTextBox since around v2.0.
    Starting at v3.3, the UI Automation has been reviewed to expose every UI control.
    A WatermarkTextBox derives from an AutoSelectTextBox.

    We did a quick test with a sample containing a button and a WatermarkTextBox, and we looked at the result from “Inspect.exe”. We can see the content of the WatermarkTextBox in the properties “Name” and “AutomationId”.

    jjacks
    Participant
    Post count: 6

    Hello,
    Thanks for your response. I do not argue with the fact that WatermarkTextBox is visible in inspect, but are you will not be able to read / write its Value since it does not support Value pattern or any other pattern typical for TextBox

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi jjacks,

    We have opened a fix request to review the situation. It will be fixed in the next release.

    In the meantime, you can go in the following file:

    Xceed.Wpf.Toolkit/Core/UIAutomation/TextBoxAutomationPeer.cs

    and replace its content with this:

       using System.Windows.Controls;
    
       namespace Xceed.Wpf.Toolkit.Core.UIAutomation
       {
          public class TextBoxAutomationPeer : System.Windows.Automation.Peers.TextBoxAutomationPeer
          {
             public TextBoxAutomationPeer( TextBox owner )
             : base( owner )
             {
             }
    
             protected override string GetClassNameCore()
             {
                return this.Owner.GetType().Name;
             }
    
             protected override string GetAutomationIdCore()
             {
                var value = base.GetAutomationIdCore();
                if( !string.IsNullOrEmpty( value ) )
                   return value;
    
                return this.GetNameCore();
             }
    
             protected override string GetNameCore()
             {
                return (( TextBox )this.Owner).Text;
             }
          }
       }
    Diane [Xceed]
    Moderator
    Post count: 1353

    The following is fixed in the latest release (v3.6).

    “In UI Automation, the WatermarkTextBox now uses the Value pattern for the Text part.”

    Download link:
    https://xceed.com/latest-xceed-datagrid-for-wpf

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.