none
Getting PreferredSize property in Label Control Using UI Automation

    Question

  • 1)  How to get the label “PreferredWidth” using the UIAutomation(Automationelement)?

    Note: ControlType.Text has no supported patterns

    I have tried with following steps to get "PreferredWidth" and it is not supporting

    Step1:- 

            private GetLabelPreferredWidth()
            {
                AutomationElement objElement = objMainWindow.AutomationElement;           
                PropertyC ondition cond = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Text);
                AutomationElement textProvider = objElement.FindFirst(TreeScope.Descendants, cond);
            }

            Note:
            I need to get the “PreferredWidth” from the “textProvider”. But it is not available



    Tuesday, April 26, 2016 10:33 AM

Answers