Automation.ContentViewCondition Bidang
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mewakili tampilan pohon Automation UI yang telah ditentukan sebelumnya yang hanya menyertakan elemen Automation UI yang dapat berisi konten.
public: static initonly System::Windows::Automation::Condition ^ ContentViewCondition;
public static readonly System.Windows.Automation.Condition ContentViewCondition;
staticval mutable ContentViewCondition : System.Windows.Automation.Condition
Public Shared ReadOnly ContentViewCondition As Condition
Nilai Bidang
Contoh
Dalam contoh berikut, berbagai kondisi statis termasuk ContentViewCondition digunakan untuk mengambil elemen.
/// <summary>
/// Examples of using predefined conditions to find elements.
/// </summary>
/// <param name="elementMainWindow">The element for the target window.</param>
public void StaticConditionExamples(AutomationElement elementMainWindow)
{
if (elementMainWindow == null)
{
throw new ArgumentException();
}
// Use TrueCondition to retrieve all elements.
AutomationElementCollection elementCollectionAll = elementMainWindow.FindAll(
TreeScope.Subtree, Condition.TrueCondition);
Console.WriteLine("\nAll control types:");
foreach (AutomationElement autoElement in elementCollectionAll)
{
Console.WriteLine(autoElement.Current.Name);
}
// Use ContentViewCondition to retrieve all content elements.
AutomationElementCollection elementCollectionContent = elementMainWindow.FindAll(
TreeScope.Subtree, Automation.ContentViewCondition);
Console.WriteLine("\nAll content elements:");
foreach (AutomationElement autoElement in elementCollectionContent)
{
Console.WriteLine(autoElement.Current.Name);
}
// Use ControlViewCondition to retrieve all control elements.
AutomationElementCollection elementCollectionControl = elementMainWindow.FindAll(
TreeScope.Subtree, Automation.ControlViewCondition);
Console.WriteLine("\nAll control elements:");
foreach (AutomationElement autoElement in elementCollectionControl)
{
Console.WriteLine(autoElement.Current.Name);
}
}
''' <summary>
''' Examples of using predefined conditions to find elements.
''' </summary>
''' <param name="elementMainWindow">The element for the target window.</param>
Public Sub StaticConditionExamples(ByVal elementMainWindow As AutomationElement)
If elementMainWindow Is Nothing Then
Throw New ArgumentException()
End If
' Use TrueCondition to retrieve all elements.
Dim elementCollectionAll As AutomationElementCollection = elementMainWindow.FindAll(TreeScope.Subtree, Condition.TrueCondition)
Console.WriteLine(vbLf + "All control types:")
Dim autoElement As AutomationElement
For Each autoElement In elementCollectionAll
Console.WriteLine(autoElement.Current.Name)
Next autoElement
' Use ContentViewCondition to retrieve all content elements.
Dim elementCollectionContent As AutomationElementCollection = elementMainWindow.FindAll(TreeScope.Subtree, Automation.ContentViewCondition)
Console.WriteLine(vbLf + "All content elements:")
For Each autoElement In elementCollectionContent
Console.WriteLine(autoElement.Current.Name)
Next autoElement
' Use ControlViewCondition to retrieve all control elements.
Dim elementCollectionControl As AutomationElementCollection = elementMainWindow.FindAll(TreeScope.Subtree, Automation.ControlViewCondition)
Console.WriteLine(vbLf & "All control elements:")
For Each autoElement In elementCollectionControl
Console.WriteLine(autoElement.Current.Name)
Next autoElement
End Sub
Berlaku untuk
Lihat juga
Berkolaborasi dengan kami di GitHub
Sumber untuk konten ini dapat ditemukan di GitHub, yang juga dapat Anda gunakan untuk membuat dan meninjau masalah dan menarik permintaan. Untuk informasi selengkapnya, lihat panduan kontributor kami.