c# - Disable Main Window WPF -
i working on wpf application running scan in main window , scan section running in thread. after completion of scan,it shows window modal popup.
now want disable main window when popup comes out after scan gets completed user can not click on main window untill close popup.but unable so.
thanks
set parent window owner child window (popup) , open child window showdialog()
below:
create "navigationservice.cs
" class , put below code in class.
public void showpopupwindow(popupwindowviewmodel popupwindowviewmodel) { popupwindowview= new popupwindowview(); popupwindowview.datacontext = popupwindowviewmodel; popupwindowview.owner = parentwindowview; popupwindowview.showdialog(); }
now, call above method in viewmodel
class below:
popupwindowviewmodel popupwindowviewmodel = new popupwindowviewmodel (); popupwindowviewmodel.name = "this popup window"; navigationservice navigationservice = new navigationservice(); navigationservice.showpopupwindow(popupwindowviewmodel);
it not let click on parent window until close child window.
Comments
Post a Comment