Custom UI Item might be a Container

Nov 2, 2009 at 8:06 AM

hi

many of our conrtols are custom controls (ControlType.Custom)

but CustomUIItem has no Get<> method

any examples how to get nested  elements without using Automation Elements?

 

 

Coordinator
Nov 4, 2009 at 3:29 PM

You can use extension methods

http://white.codeplex.com/wikipage?title=UI%20Items

Look at WPF Items section.

Nov 9, 2009 at 11:16 AM

Hi

I get an exception to get all Items in the Container

at Core.UIItems.UIItem..ctor(AutomationElement automationElementActionListener actionListener) in d:\white\Core\UIItems\UIItem.cs: line 36
at Core.UIItems.UIItemContainer..ctor(AutomationElement automationElementActionListener actionListenerInitializeOption initializeOptionWindowSession windowSession) in d:\white\Core\UIItems\UIItemContainer.cs: line 24
at Core.UIItems.UIItemContainer..ctor(AutomationElement automationElementActionListener actionListener) in d:\white\Core\UIItems\UIItemContainer.cs: line 31
at Core.UIItems.UIItem.AsContainer() in d:\white\Core\UIItems\UIItem.cs: line 347
at Core.UIItems.WPFUIItems.WPFUIItem.GetUiItemContainer(UIItem uiItem) in d:\white\Core\UIItems\WPFUIItems\WPFUIItem.cs: line 17
at Core.UIItems.WPFUIItems.WPFUIItem.GetMultiple(UIItem uiItemSearchCriteria criteria) in d:\white\Core\UIItems\WPFUIItems\WPFUIItem.cs: line 22
at ETS4SystemTest.Workplace.ViewOperations.CrossOverViewUpdateTests.CrossOverCheckInTwoBuildingViews() in CrossOverViewUpdateTests.cs: line 58
Code:
ETS4Control ets4Control = TestSharedFunctions.Ets4Window.Get<ETS4Control>(SearchCriteria.ByAutomationId("ETS4Control"));
IUIItem[] items = ets4Control.GetMultiple(SearchCriteria.All);



ETS4Control:

using System.Windows.Automation;
using Core.UIItems.Actions;
using Core.UIItems.Custom;

namespace ETS4SystemTest.CustomUIItems
{
  [ControlTypeMapping(CustomUIItemType.Custom)]
  public class ETS4Control : CustomUIItem
  {
    // Implement these two constructors. The order of parameters should be same.
    public ETS4Control(AutomationElement automationElement, ActionListener actionListener)
      : base(automationElement, actionListener)
    {
    }

    //Empty constructor is mandatory with protected or public access modifier.
    protected ETS4Control() {}
  }
}