WPF XAML designer showing bound property names instead of property values

淺唱寂寞╮ 提交于 2019-12-06 03:06:50

I ran into this issue but the cause was actually that I didn't have the Enable Project Code in XAML Designer enabled.

Turns out the missing thing was the IsDesignTimeCreatable attribute:

d:DataContext="{d:DesignInstance vm:MyDesignTimeViewModel, IsDesignTimeCreatable=true}"

With that attribute, everything works as expected.

To echo J.G.'s answer, the fix was to enable project code in the XAML designer which had mysteriously been disabled at some point.

New account so I can't vote or comment, I just didn't like seeing a correct answer downvoted.

Thankyou for the last two answers. In my case 'Enable Project Code in XAML' has randomly turned off as well! I didnt have the designer pulling the view model code for a few weeks. So very happy this has been fixed. So in all to get this working you need:

d:DataContext="{d:DesignInstance vm:MyDesignTimeViewModel}"

and the little icon with a blue square and caption 'Enable Project Code in XAML' to be turned on!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!