ContentElement.Focusable プロパティ

定義

要素がフォーカスを得ることができるかどうかを示す値を取得または設定します。

public:
 property bool Focusable { bool get(); void set(bool value); };
public bool Focusable { get; set; }
member this.Focusable : bool with get, set
Public Property Focusable As Boolean

プロパティ値

Boolean

要素がフォーカス可能な場合は、true。それ以外の場合は、false。 既定値は、false です。

実装

次の例では、既定でフォーカス可能なスタイルを Paragraph 作成し、フォーカスを受け取ったときに視覚的な動作を提供します。

<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>

注釈

フォーカスされた要素のみがキーボード入力を受け取ります。

特定の派生クラスは、既定で派生クラスがフォーカスできるように、この依存関係プロパティのメタデータをオーバーライドする可能性があります。

派生クラスによって Hyperlink 継承された場合は、 Hyperlink この依存関係プロパティのメタデータをオーバーライドし、このプロパティの既定値を再定義します true

依存関係プロパティの情報

識別子フィールド FocusableProperty
メタデータのプロパティが次に設定されている true なし

継承者へのメモ

派生 ContentElement元の場合は、要素をフォーカス可能にするかどうかを検討します。既定ではフォーカスが設定できないためです。 要素をフォーカス可能にする場合は、派生クラスの静的コンストラクターで、このプロパティのメタデータを次のようにオーバーライドします。

FocusableProperty.OverrideMetadata(typeof(myElement), new UIPropertyMetadata(true));
FocusableProperty.OverrideMetadata(GetType(myElement), New UIPropertyMetadata(True))

ここで myElement 、メタデータ値をオーバーライドする型のクラス名を指定します。

適用対象

こちらもご覧ください