ValuePattern.IsReadOnlyProperty 欄位

定義

識別 IsReadOnly 屬性。Identifies the IsReadOnly property.

public: static initonly System::Windows::Automation::AutomationProperty ^ IsReadOnlyProperty;
public static readonly System.Windows.Automation.AutomationProperty IsReadOnlyProperty;
 staticval mutable IsReadOnlyProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly IsReadOnlyProperty As AutomationProperty 

欄位值

範例

在下列範例中, 會將根項目傳遞至函式, 該函式會傳回屬於根系的使用者介面自動化專案集合, 並滿足一組屬性條件。In the following example, a root element is passed to a function that returns a collection of UI automation elements that are descendants of the root and satisfy a set of property conditions.

///--------------------------------------------------------------------
/// <summary>
/// Finds all automation elements that satisfy 
/// the specified condition(s).
/// </summary>
/// <param name="targetApp">
/// The automation element from which to start searching.
/// </param>
/// <returns>
/// A collection of automation elements satisfying 
/// the specified condition(s).
/// </returns>
///--------------------------------------------------------------------
private AutomationElementCollection FindAutomationElement(
    AutomationElement targetApp)
{
    if (targetApp == null)
    {
        throw new ArgumentException("Root element cannot be null.");
    }

    PropertyCondition conditionIsReadOnly =
        new PropertyCondition(
        ValuePattern.IsReadOnlyProperty, false);

    return targetApp.FindAll(
        TreeScope.Descendants, conditionIsReadOnly);
}
'''--------------------------------------------------------------------
''' <summary>
''' Finds all automation elements that satisfy 
''' the specified condition(s).
''' </summary>
''' <param name="targetApp">
''' The automation element from which to start searching.
''' </param>
''' <returns>
''' A collection of automation elements satisfying 
''' the specified condition(s).
''' </returns>
'''--------------------------------------------------------------------
Private Function FindAutomationElement( _
ByVal targetApp As AutomationElement) As AutomationElementCollection
    If targetApp Is Nothing Then
        Throw New ArgumentException("Root element cannot be null.")
    End If

    Dim conditionIsReadOnly As New PropertyCondition( _
    ValuePattern.IsReadOnlyProperty, False)

    Return targetApp.FindAll(TreeScope.Descendants, conditionIsReadOnly)

End Function 'FindAutomationElement    

備註

這個識別碼是由使用者介面自動化用戶端應用程式所使用。This identifier is used by UI Automation client applications. 使用者介面自動化提供者應使用中ValuePatternIdentifiers的對等欄位。UI Automation providers should use the equivalent field in ValuePatternIdentifiers.

在用戶端嘗試呼叫IsEnabledProperty之前, true控制項應IsReadOnlyProperty將其false設定為, 並將其設定SetValue為。A control should have its IsEnabledProperty set to true and its IsReadOnlyProperty set to false before a client attempts a call to SetValue.

適用於

另請參閱