Este artigo foi traduzido por máquina. Para visualizar o arquivo em inglês, marque a caixa de seleção Inglês. Você também pode exibir o texto Em inglês em uma janela pop-up, movendo o ponteiro do mouse sobre o texto.
Tradução
Inglês

Propriedade UIElement.Focusable

 

Obtém ou define um valor que indica se o elemento pode receber foco. É uma propriedade de dependência.

Namespace:   System.Windows
Assembly:  PresentationCore (em PresentationCore.dll)

public bool Focusable { get; set; }

Valor da Propriedade

Type: System.Boolean

true se o elemento for focalizável; caso contrário, false. O padrão é false, mas consulte Comentários.

Only the focused element receives keyboard input.

Focusable is the Microsoft .NET property accessor for what is in reality a dependency property. This particular dependency property quite frequently has its apparent "default" value set differently in derived element classes, particularly in controls. This commonly occurs in one of two ways:

  • The dependency property is inherited by a particular derived class, but that derived class overrides the metadata of the dependency property and changes the property default value.

  • A style or template is applied to an element, which sets that dependency property value differently.

For example, the apparent "default" of P:System.Windows.UIElement.Focusable for a T:System.Windows.Controls.Button control will be true, even though T:System.Windows.Controls.Button inherits P:System.Windows.UIElement.Focusable as a TLA#tla_clr property directly from T:System.Windows.UIElement. This is because the applied metadata value for the P:System.Windows.UIElement.Focusable dependency property was overridden within the static constructor of the T:System.Windows.Controls.Control base class, which is situated between T:System.Windows.Controls.Button and T:System.Windows.UIElement in the class hierarchy.

When inherited by T:System.Windows.Controls.Control or its derived classes, T:System.Windows.Controls.Control redefines the default value of this property to be true.

When inherited by T:System.Windows.Controls.Label (which is a T:System.Windows.Controls.Control derived class), the default value is again redefined to be false.

Identifier field

FocusableProperty

Metadata properties set to true

None

Observações para os Herdeiros:

When deriving from T:System.Windows.UIElement directly (as opposed to from T:System.Windows.Controls.Control), consider whether you wish your element to be focusable, because by default the element will not be focusable. If you wish your element to be focusable, override the metadata for this property within your type's static constructor as follows:

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

where myElement should be the class name of the type that you are overriding the metadata value on.

The following example code illustrates a control template for a particular custom control, which sets P:System.Windows.UIElement.Focusable false on one of the elements within the template.

.NET Framework
Disponível desde 3.0
Retornar ao início
Mostrar: