SelectionPattern.SelectionProperty Fält
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Identifierar egenskapen som hämtar de markerade objekten i en container.
public: static initonly System::Windows::Automation::AutomationProperty ^ SelectionProperty;
public static readonly System.Windows.Automation.AutomationProperty SelectionProperty;
staticval mutable SelectionProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly SelectionProperty As AutomationProperty
Fältvärde
Exempel
I följande exempel hämtas en samling med AutomationElements som representerar de markerade objekten i en markeringscontainer.
///--------------------------------------------------------------------
/// <summary>
/// Gets the currently selected SelectionItem objects from target.
/// </summary>
/// <param name="selectionContainer">
/// The current Selection container object.
/// </param>
///--------------------------------------------------------------------
private AutomationElement[] GetCurrentSelectionProperty(
AutomationElement selectionContainer)
{
try
{
return selectionContainer.GetCurrentPropertyValue(
SelectionPattern.SelectionProperty) as AutomationElement[];
}
// Container is not enabled
catch (InvalidOperationException)
{
return null;
}
}
'''--------------------------------------------------------------------
''' <summary>
''' Gets the currently selected SelectionItem objects from target.
''' </summary>
''' <param name="selectionContainer">
''' The current Selection container object.
''' </param>
'''--------------------------------------------------------------------
Private Function GetCurrentSelectionProperty( _
ByVal selectionContainer As AutomationElement) As AutomationElement()
Try
Return DirectCast(selectionContainer.GetCurrentPropertyValue( _
SelectionPattern.SelectionProperty), AutomationElement())
' Container is not enabled
Catch
Return Nothing
End Try
End Function 'GetCurrentSelectionProperty
Kommentarer
Den här identifieraren används av UI Automation klientprogram. UI Automation providers bör använda motsvarande fält i SelectionPatternIdentifiers.
Den här egenskapen finns inte i SelectionPattern.SelectionPatternInformation och måste hämtas med hjälp GetCurrentPropertyValue av eller GetCachedPropertyValue.