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

속성 값

요소가 포커스를 받을 수 있으면 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 는 메타데이터 값을 재정의하는 형식의 클래스 이름입니다.

적용 대상

추가 정보