The following scenario illustrates how keyboard focus and logical focus change in a WPF application that has a Window with a TextBox and a Menu that has a MenuItem. In this case, both the parent focus scope and the child focus scope can have a FocusManager.FocusedElement. It is possible to define a focus scope within a focus scope. An element with logical focus does not necessarily have keyboard focus, but an element with keyboard focus will have logical focus. There can be multiple elements with logical focus, but there can only be one element with logical focus within a single focus scope. An element that is a focus scope has IsFocusScope set to true. By default, the Window class is a focus scope as are the Menu, ContextMenu, and ToolBar classes. Logical focus pertains to the FocusManager.FocusedElement within a specific focus scope.Ī focus scope is a container element that keeps track of the FocusManager.FocusedElement within its scope. Keyboard.FocusedElement returns the element with keyboard focus. This element with keyboard focus has IsKeyboardFocused set to true. There can be only one element with keyboard focus. Keyboard focus pertains to the element that is currently receiving keyboard input. In Windows Presentation Foundation (WPF) there are two concepts concerning focus: keyboard focus and logical focus.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |