I have a custom TreeView-like control in a panel in my application. As you click on items they receive keyboard focus.
It's possible to select a set of items in the tree and cut or remove them by pressing Ctrl-X or Delete. When the tree items are removed, keyboard focus reverts to the main window.
This leads to trouble - if I Undo my cut, I get my elements back but keyboard focus is no longer on my panel so I can't (for example) go cut-undo-cut-undo-cut.
What determines where the keyboard focus moves when an element is removed? I quickly tried making my panel have IsFocusScope="True" but that didn't seem to have any effect, and the Focus Overview doesn't mention how to control where focus goes when an element is removed.