Blend not showing MVVM property values in design mode but shows object in binding dialougs, works fine when built

StackOverflow https://stackoverflow.com/questions/20809635

  •  22-09-2022
  •  | 
  •  

Вопрос

I am using MVVM light and blend. For awhile everything was good. Now though when I look at my views in blend no data from the views are being bound. I have some data that is static and some that is being provided from design time data providers.

1) Everything works fine at run time

2) My VM shows in blend in the binding dialougs for fields (i.e. dialoug for binding a text field to my model.

3) I get no errors in blend.

4) I have tried commenting out all the design time provider includes (ViewModelLocator SimpleIoC) does not change anything.

5) A simple property like a static field of "Page Name" or "Applicaiton Title" no longer shows in design time.

Bottom line is all I get in design time is a blank black screen. But in run time all is good.

Any thoughts? I am sure I have something it does not like but without errors it is hard to known.

.Net 4.5, VS 2013, Blend 4

Это было полезно?

Решение

After spending some time to comment out some code I found what was happening. There was a line of code that was erroring out when run by Blend. Blend was executing a line of code that was returnig null and erroring out. As soon as I changed that line of code (commented it out or fixed it so it does not throw an error on accessing it in design mode), all the properties bind and show in Blend.

If you are seeing this pull up your ViewModel code and look at whatcode is running in the constructor. Easiest thing to do is just comment out all the code, save and then build the project in blend (this will force Blend to reload the view). See if things start showing agian.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top