views:

160

answers:

2

Hello,

I have a Canvas and in it a Border. Now I want to give focus to this Border. Can somebody please tell me how do do this? Seems like it's not that easy ): Thanks for any hint!

A: 

Border inherits from UIElement (via System.Windows.FrameworkElement and System.Windows.Controls.Decorator) so you can call the Focus method from the C# (or VB, C++, F#) code.

ChrisF
Thanks for your reply, but I tried that, it seems not to work. The Border doesn't receive any Keyboard events, also it gets no dotted border (shouldn't it get this?).
stefan.at.wpf
A: 

I haven't tried it for Borders, but with a WPF ContentControl, I think I had to set IsTabStop and IsEnabled to true to get it to be able to accept focus.

Brian
`IstabStop` is defined in Control, and Border does not derive from Control.
Henk Holterman