Design time data in Windows Store app

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 04:28:03

问题


In WP7 I am used to generating sample data (XML) from my ViewModels in Blend and seeing them in Visual Studio.

In Blend 2012 I cannot find the option to generate design time data. The tempales in Visual Studio use design time data genarated in code. Is it the only way? No more XML design time data?


回答1:


I don't think generating design time data in Blend for VS2012 is possible, but it's still possible to use design time data created in code, but even this is more complicated than in WP7. Basically you have to use this construct in XAML to make it work:

<Page.Resources>
    <CollectionViewSource x:Name="imagesSource" Source="{Binding Model.Images}" 
        d:Source="{Binding Model.Images, Source={d:DesignInstance Type=local:MainViewModel, IsDesignTimeCreatable=True}}"/>
</Page.Resources>

The important part here is the "d:DesignInstance" and "IsDesignTimeCreatable=True", the rest is quite similar to WP7.




回答2:


Not possible to use design time data in XML like in WP7



来源:https://stackoverflow.com/questions/12352724/design-time-data-in-windows-store-app

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