FocusVisualStyle Property

FrameworkContentElement.FocusVisualStyle Property


Gets or sets an object that enables customization of appearance, effects, or other style characteristics that will apply to this element when it captures keyboard focus.

Namespace:   System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

public Style FocusVisualStyle { get; set; }

Property Value

Type: System.Windows.Style

The desired style to apply on focus. The default value as declared in the dependency property is an empty static Style. However, the effective value at run time is often (but not always) a style as supplied by theme support for controls.

When setting this property in XAML, styles are almost always defined as a resource, rather than inline as an element, and that resource is usually referenced as a StaticResourceExtension.

Note that this property affects visual appearance but does not report so in metadata. This is because the visual appearance change is event-driven and may not apply at all times, and thus should not generally report any visual or layout information in metadata.

Conceptually, the visual behavior of focus applied to a control should be coherent from element to element. The most sensible way to enforce coherence is to only change the focus visual style if you are composing an entire theme. Setting this property on individual styles and not as part of a theme is not the intended usage of this property, because it may lead to a confusing user experience regarding keyboard focus. If you are intending element-specific behavior that is deliberately not coherent across a theme, a much better approach is to use triggers in styles for individual input state properties, such as IsFocused or IsKeyboardFocusWithin, and to do so in a way that does not visually interfere with any existing focus visual style. For more information on the design intention of FocusVisualStyle and alternative focus properties, see Styling for Focus in Controls, and FocusVisualStyle.

<object FocusVisualStyle="{resourceExtension styleResourceKey}"/>


One of the following: , or . See XAML Resources.


The key that identifies the style being requested. The key refers to an existing resource in a ResourceDictionary.


Property element syntax is technically possible, but not recommended. See Inline Styles and Templates. A binding reference using or Binding is also possible, but uncommon.

Identifier field


Metadata properties set to true


.NET Framework
Available since 3.0
Return to top
© 2015 Microsoft