简体   繁体   中英

IsInDesignMode not working for 1 ViewModel, but the other

I do have my DataContext for DesignMode set like this:

d:DataContext="{d:DesignInstance vm:ViewModelName, IsDesignTimeCreatable=True}"

In total I have lets say 2 ViewModels in both I have defined IsInDesignModeStatic in the Constructor and am creating TestData (Objects) in both.

In both Views I do have my DataTemplates defined, which shouldnt make any difference but still...

Both Viewmodels are defined in the same namespace.

Visual Studio and Blender are suggesting me both ViewModels.

One ViewModel is working in both Views the other one is not and keeps on giving me the error message

object reference not set to an instance of an object

What am I possibly missing?

object reference not set to an instance of an object

This error means you have a null pointer. Look in your model something is not initialized.

It should not be difficult to investigate especially if you have unit test in place.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM