I have a simple UserControl which executes a routed command when user double clicks:
<UserControl.InputBindings>
<MouseBinding Command="someRoutedCommand" Gesture="LeftDoubleClick" />
</UserControl.InputBindings>
Somewhere upper in the visual tree this routed command is bound to the procedure:
<UserControl.CommandBindings>
<CommandBinding Command="someRoutedCommand" Executed="someProc"/>
</UserControl.CommandBindings>
The procedure opens a new window:
private void someProc(object sender, ExecutedRoutedEventArgs e)
{
var win = new SomeWindow();
win.Show();
//win.Activate();
}
The problem is that the new window doesn't remain active. It become active for a while and then the main window acivates again. How can I avoid this?
I've just realised tahat this problem occures only if i embed the control in a TreeView. If it is places just in a Window's Grid it works OK.