简体   繁体   English

使用静态ObservableCollection作为FallbackValue

[英]Using a static ObservableCollection as FallbackValue

I have a simple question. 我有一个简单的问题。

Is it possible to populate a static ObservableCollection and use that during design time as a FallbackValue so you can see what your results would look like? 是否可以填充静态的ObservableCollection并将其在设计时用作FallbackValue以便您可以看到结果如何?

The thing is, compiling my project and navigating to my view takes a lot of time, so I want to do as much as I can during design time. 关键是,编译项目并导航至视图需要很多时间,因此我想在设计期间尽力而为。 The "FallbackValue" trick works for common controls like TextBoxes. “ FallbackValue”技巧适用于诸如TextBoxes之类的常见控件。 Of course this is somewhat abusing FallbackValue as its purpose is to provide some other placeholding data when the binding fails. 当然,这在某种程度上滥用了FallbackValue,因为其目的是在绑定失败时提供其他占位数据。

Any thoughts? 有什么想法吗?

What you are after is called design time data. 您追求的是设计时间数据。 See this question on how to implement it and there is a lot of articles available out there. 有关如何实现它的问题 ,请参见此问题 ,这里有很多文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM