Silverlight/WPF 和 Blend:DataBind 文本字段,但定义设计时值?
希望这很简单 - 我在 Silverlight 应用程序中 DataBind 一堆标签和文本控件(到我在类中创建的 DependencyProperties),但当然文本在设计时是空的。
我仍然想知道这将如何安排;有没有办法指定设计时值,即使它是数据绑定的?
Hopefully this is simple - I DataBind a bunch of labels and text controls in a Silverlight application (to DependencyProperties that I create in my class), but of course the text is empty at design time.
I'd still like to have an idea of how this will be laid out; is there a way to specify a design-time value, even though it's databound?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找的功能是“表达式混合示例数据”。
示例数据允许您指定其中包含一些示例字段(名称、地址、数字、图像、层次结构等)的设计时数据源。
这是一篇很好的介绍文章:
http://silverzine.com/tutorials/how -to-create-sample-data-in-blend-3/
以下是示例数据的链接集合:
http://martinkruszynski.blogspot.com/ 2009/08/expression-blend-3-sample-data-data.html
示例数据的核心是您使用在混合中构建模拟设计时数据源(形状像您的数据类型),定义示例的类型数据和绑定经过评估,可为您提供有意义的设计时体验。
The feature you're looking for is Expression Blend Sample Data.
Sample Data allows you to specify a Design Time data source that has some sample fields in it (names, addresses, numbers, images, hierarchies, etc).
Here's a good introduction article:
http://silverzine.com/tutorials/how-to-create-sample-data-in-blend-3/
And here's a collection of links on Sample data:
http://martinkruszynski.blogspot.com/2009/08/expression-blend-3-sample-data-data.html
The core of Sample Data is you use build a mock design time datasource in blend (shaped like your data types), define the type of sample data and the bindings get evaluated to give you a meaningful design time experience.