I'm having an issue where the property IsInDesignMode is not retur开发者_开发技巧ning the expected value of true when running the solution in VS or Blend. My environment consists of Win Server 2008 R2, VS2010 Pro, Blend 4 and MVVM Light V3. I run my Silverlight 4 solution in Debug mode from VS and Blend, and IsInDesignMode is always false. Am I missing a setting? Is there a reason why it may not be picking up the environment? Thanks in advance.
-Greg
It should work properly. The only place where I know that IsInDesignMode returns a wrong value is when using it to build code that runs within Visual Studio, such as VS plug-ins. This is an issue that is very difficult to solve. It doesn't sound like it is what you are doing, though...
Do you have a repro that I can test? Alternatively, could you download the MVVM Light code and debug this?
Thanks, Laurent
Kill all XDesProc.exe
processes in task manager and then click "restart the designer" in visual studio.
This always fixes it for me.
Did you try if (IsInDesignModeStatic){ ... } instead?
I run my Silverlight 4 solution in Debug mode from VS and Blend, and IsInDesignMode is always false. Am I missing a setting?
The IsInDesignMode flags should only be true when running inside the designer in either Visual Studio or Blend. Once you run the application in the debugger, the values should be false. This feature should be used to design your Views inside the designer without needing to run the application.
I ran into this myself in Visual Studio 2013. I also had the project open in Blend at the same time. I closed VS2013, closed Blend, reopened in VS 2013, and once again all was right with the world (IsInDesign returned TRUE).
精彩评论