开发者

Expression blend and mock data

I have an Item template and I want to design it, but I can't see what the stuff looks like in blend because I am databinding it to objects that doesn't exist in blend.

Is there a way that I 开发者_开发问答can make fake data come up to do this?

They are textblocks.


You have two options provided by blend and you can also use other techniques as well.

Here is the link that explains how to add dummy data in blend for design purposes.

  1. Create a dummy data source using blend and bind it to your control(look for advanced properties,databinding)

  2. You can import xml data through blend.

Click here for the other techniques and more information

click here for new blog post on design time data

Hope this helps.


As a very quick and simple solution you can supply a fallback value as follows:

<TextBlock Text="{Binding Path=MyProperty, FallbackValue=Some text to show when binding fails}" />

Note that this will also show up in your application if MyProperty cannot be found.

If you want to bind a ListBox (or something else) to more complex data you can use Blend to create it, but this is probably overkill for your TextBlocks. See this tutorial for a walkthrough.


Create your dummy objects as form resources. Bind your controls at design time to the resources, and then you can see your dummy data displayed at design time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜