ValuePattern.IsReadOnlyProperty 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
識別 IsReadOnly 屬性。
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
欄位值
範例
在下列範例中,根元素會傳遞至函式,此函式會傳回根子系的UI自動化專案集合,並滿足一組屬性條件。
///--------------------------------------------------------------------
/// <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
備註
使用者介面自動化用戶端應用程式會使用此標識碼。 使用者介面自動化提供者應該使用 中的 ValuePatternIdentifiers對等欄位。
控制項應該IsEnabledProperty設定為 true
,並在IsReadOnlyProperty客戶端嘗試呼叫 SetValue之前將其設定為 false
。