Gets or sets a value that indicates whether the element can receive focus. This is a dependency property.
Assembly: PresentationCore (in PresentationCore.dll)
Only the focused element receives keyboard input.
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 Button control will be true, even though Button inherits as a common language runtime (CLR) property directly from UIElement. This is because the applied metadata value for the dependency property was overridden within the static constructor of the Control base class, which is situated between Button and UIElement in the class hierarchy.for a
Notes to Inheritors:
When deriving from UIElement directly (as opposed to from 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:
where myElement should be the class name of the type that you are overriding the metadata value on.
Available since 3.0