Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ContentElement.IsFocused Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets a value that determines whether this element has logical focus.

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

public bool IsFocused { get; }

Property Value

Type: System.Boolean

true if this element has logical focus; otherwise, false.

Logical focus might differ from keyboard focus if an application has multiple focus divisions, such as between menu contents and the remainder of the application. In this scenario, keyboard focus can only be on one element of the application UI, however, certain elements in other focus divisions might still retain logical focus. For more information on logical focus, see Input Overview and Focus Overview.

Identifier field


Metadata properties set to true


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"/>
    <Trigger Property="IsFocused" Value="True">
      <Setter Property = "Background" Value="{StaticResource BlueGreenBrush}"/>

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