Data is not displayed in design mode

I have my models, models and representations of representations and the correct setting when the program is running, but when in development mode I see neither data nor dynamic elements that are controlled by data. What I miss I looked at an example application for friends and did not see anything else. Any help would be appreciated.

+4
source share
2 answers

The design view does not support connections to your database, so if your view model constructors load any data from the database, then this will throw an exception when switching to the design view. Therefore, your user interface elements will not load properly.

Instead, you will need to load dummy data if you are in development mode. You can programmatically check whether you are in development mode using the MVVM-Light Toolkit ViewModelBase.IsInDesignModeStatic property.

For instance:

ViewModelConstructor() { if (ViewModelBase.IsInDesignModeStatic) { // load dummy data } else { // load real data from database } } 
+3
source

Generally, you should use DEBUG, why project data is not displayed. In most cases, this is because exceptions are thrown somewhere in your code when the designer executes them. As Laurent mentioned in his videos, one way is to join your Blend process in Visual Studio. I tried this approach in my project and it worked great.

0
source

Source: https://habr.com/ru/post/1440676/


All Articles