c# - Detect if WPF application is running or in Visual Studio windows visualizer -




i have wpf application opens popup when main window loaded. problem when select .xaml file in solution explorer in visual studio 2013, the popup "pops" when application not running. suppose intended behavior since visualizer needs execute code in order render page layout, need close every time load page... cannot temporarily disable popup since has start logic application (selection of location,...).

here code of popup trigger

public generalprocess() //usercontrol {     initializecomponent();     loaded += generalprocess_loaded; }  void generalprocess_loaded(object sender, routedeventargs e) {     var popup = new stationselect();     popup.owner = window.getwindow(this);     popup.showdialog(); } 

is there way know if application running or if in visualizer, or there way disable loadedevent visual studio ? goal still able see page easy editing.

edit : question duplicate. this answer worked me.

void generalprocess_loaded(object sender, routedeventargs e) {     if (designerproperties.getisindesignmode(this))         return;     var popup = new stationselect();     popup.owner = window.getwindow(this);     popup.showdialog(); } 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -