Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make child window always on top of all windows

I'm writing in wpf. In my viewModel I have a command that opens new window. However sometimes this child window is placed under the parent window. (if for instance I work in my application, then open browser and want to return to my application). Window is opened as follows:

MyViewModel vm = new MyViewModel(oper);
Mywindow window = new MyWindow();
//Initialize viewModel and set window.DataContext to this viewModel
CWPFWindowWithViewModelHelper<IWindowWithViewModel>.InitializeViewModel(window, vm);
window.ShowDialog();

I want this child window to be always visible when opened. How can I do this?

like image 963
niao Avatar asked Nov 27 '25 15:11

niao


1 Answers

just try with

window.Owner=this
like image 74
Kishore Kumar Avatar answered Nov 29 '25 19:11

Kishore Kumar