Gets or sets a value that indicates whether the element can receive focus.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Public Property Focusable As [%$TOPIC/ms600602_en-us_VS_110_1_0_0_0_0%]
public [%$TOPIC/ms600602_en-us_VS_110_1_0_1_0_0%] Focusable { get; set; }
public:
virtual property [%$TOPIC/ms600602_en-us_VS_110_1_0_2_0_0%] Focusable {
[%$TOPIC/ms600602_en-us_VS_110_1_0_2_0_1%] get () sealed;
void set ([%$TOPIC/ms600602_en-us_VS_110_1_0_2_0_2%] value) sealed;
}
abstract Focusable : [%$TOPIC/ms600602_en-us_VS_110_1_0_3_0_0%] with get, set
override Focusable : [%$TOPIC/ms600602_en-us_VS_110_1_0_3_0_1%] with get, set
<object Focusable="[%$TOPIC/ms600602_en-us_VS_110_1_0_4_0_0%]" .../>
Property Value
Type: SystemBooleantrue if the element is focusable; otherwise false. The default is false; however, see Remarks.
Implements
IInputElementFocusableOnly the focused element receives keyboard input.
Certain derived classes might override metadata for this dependency property such that the derived class is focusable by default.
When inherited by Hyperlink or its derived classes, Hyperlink overrides the metadata for this dependency property and redefines the default value of this property to be true.
Notes to InheritorsWhen you derive from ContentElement, consider whether you want your element to be focusable, because by default it will not be focusable. If you want your element to be focusable, override the metadata for this property in your derived class static constructor as follows:
FocusableProperty.OverrideMetadata(GetType(myElement), New UIPropertyMetadata(True))
FocusableProperty.OverrideMetadata(typeof(myElement), new UIPropertyMetadata(true));
where myElement is the class name of the type that you are overriding the metadata value on.
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>
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.