We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

UITechnologyElement.TopLevelElement Property

Gets or sets the top-level window for this element.

Namespace:  Microsoft.VisualStudio.TestTools.UITest.Extension
Assembly:  Microsoft.VisualStudio.TestTools.UITest.Extension (in Microsoft.VisualStudio.TestTools.UITest.Extension.dll)

public abstract UITechnologyElement TopLevelElement { get; set; }

Top-level windows are typically children of the desktop. If this property is not set, the test framework sets the value to the topmost ancestor of the element, and ignores the desktop as an ancestor.