FocusSite Property

Returns the element in the visual tree that was named 'PART_FocusSite'.
Protected ReadOnly Property FocusSite As DependencyObject
protected DependencyObject FocusSite {get;}

This will be a class derived from FrameworkElement or FrameworkContentElement or null.

FocusSite indicates the element that will receive keyboard focus whenever the editor is in edit mode. This way the keyboard messages get delivered to this element. For example, XamTextEditor defines a TextBox as PART_FocusSite in its edit control template. Whenever XamTextEditor is in edit mode, it gives focus to the TextBox so all the keyboard messages get delivered to the TextBox for processing.

Different editors will define different elements as their FocusSite. If you define a custom edit template for an editor, make sure the element that will perform the editing in response to keyboard messages is named PART_FocusSite so the editor knows which element to give keyboard focus when it receives the focus.


Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also