tags:

views:

1248

answers:

2

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?

+7  A: 

You should be able to base your property trigger on the IsKeyboardFocusWithin property, which returns true if any child element has focus.

Matt Hamilton
+1  A: 

Thanks Matt. You saved me hours of retemplating!