FrameworkElement.FocusVisualStyle Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a property that enables customization of appearance, effects, or other style characteristics that will apply to this element when it captures keyboard focus.
public:
property System::Windows::Style ^ FocusVisualStyle { System::Windows::Style ^ get(); void set(System::Windows::Style ^ value); };
public System.Windows.Style FocusVisualStyle { get; set; }
member this.FocusVisualStyle : System.Windows.Style with get, set
Public Property FocusVisualStyle As Style
Property Value
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.
Remarks
This property affects visual appearance but does not report AffectsRender in metadata. This is because the visual appearance change is event-driven and may not apply at all times, and therefore 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 control to control. 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 control 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 control-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.
XAML Attribute Usage
<object FocusVisualStyle="{resourceExtension styleResourceKey}"/>
XAML Property Element Usage
XAML Values
resourceExtension
One of the following: , or . See XAML Resources.
styleResourceKey
The key that identifies the style being requested. The key refers to an existing resource in a ResourceDictionary.
Note
Property element syntax is technically possible, but not recommended. See Inline Styles and Templates. A binding reference using TemplateBinding or Binding is also possible, but uncommon.
Dependency Property Information
Identifier field | FocusVisualStyleProperty |
Metadata properties set to true |
None |