ContentElement.IsFocused ContentElement.IsFocused ContentElement.IsFocused ContentElement.IsFocused Property

定義

取得值,決定這個項目是否具有邏輯焦點。Gets a value that determines whether this element has logical focus.

public:
 property bool IsFocused { bool get(); };
public bool IsFocused { get; }
member this.IsFocused : bool
Public ReadOnly Property IsFocused As Boolean

屬性值

如果這個項目具有邏輯焦點,則為 true;否則為 falsetrue if this element has logical focus; otherwise, false.

範例

下列範例會建立一個樣式, 使其Paragraph預設為可設定焦點, 並在收到焦點時提供視覺效果的行為。The following example creates a style that makes a Paragraph focusable by default and gives it a visual behavior when it receives focus.

<Style x:Key="FocusableParagraph" TargetType="{x:Type Paragraph}">
  <Setter Property="Focusable" Value="true"/>
  <Style.Triggers>
    <Trigger Property="IsFocused" Value="True">
      <Setter Property = "Background" Value="{StaticResource BlueGreenBrush}"/>
    </Trigger>
  </Style.Triggers>
</Style>

備註

如果應用程式有多個焦點區域 (例如, 功能表內容與應用程式的其餘部分), 則邏輯焦點可能會與鍵盤焦點不同。Logical focus might differ from keyboard focus if an application has multiple focus divisions, such as between menu contents and the remainder of the application. 在此案例中, 鍵盤焦點只能在應用程式 UI 的一個元素上, 不過, 其他焦點部門中的某些專案可能仍會保有邏輯焦點。In this scenario, keyboard focus can only be on one element of the application UI, however, certain elements in other focus divisions might still retain logical focus. 如需邏輯焦點的詳細資訊, 請參閱輸入總覽焦點總覽For more information on logical focus, see Input Overview and Focus Overview.

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field IsFocusedProperty
中繼資料屬性設定為trueMetadata properties set to true None

適用於

另請參閱