简体   繁体   中英

Passing focus of child element in a UserControl to parent in WPF

I have a complex WPF UserControl made of other ContentControl templates which contain sets of buttons, textfields, and other elements.

The parent UC is focusable so I have a style with a property trigger to update (gratuitous OuterGlowBitmapEffect) when the UC has focus. However when the user clicks or tabs to any of the buttons inside the UC the focus is lost. I would like to maintain the glow while using the UC.

Can I pass the focus from the child controls up to the UC?

您应该能够将属性触发器基于IsKeyboardFocusWithin属性,如果任何子元素具有焦点,则返回true。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM