简体   繁体   English

IEnumerable异步的虚拟FallbackValue

[英]Dummy FallbackValue for IEnumerable Asynchronous

I am trying to debug some of the databinding/performance issues in my MVVM program (Josh Smith based). 我正在尝试调试MVVM程序(基于Josh Smith)中的某些数据绑定/性能问题。 There is a lot of concurrent loading of different lists and objects, so I've been using isAsync and some threading to improve performance and network bottlenecks. 并发加载了很多不同的列表和对象,因此我一直在使用isAsync和一些线程来提高性能和网络瓶颈。

However, I am noticing a lot of messages being output from ItemsSource bindings on the fallback values. 但是,我注意到从回退值上的ItemsSource绑定输出了许多消息。 For commands I created a dummy command which disables commands, and for most things I can bind to a known fallback primitive type. 对于命令,我创建了一个虚拟命令来禁用命令,对于大多数事情,我可以绑定到已知的后备原语类型。 The issue seems to come when I bind an ItemsSource's fallback to {x:Null}. 当我将ItemsSource的后备绑定绑定到{x:Null}时,似乎出现了问题。

Note: This is happening in many spots not just the chartingToolkit controls 注意:这不仅在chartingToolkit控件中,还在很多地方发生

A first chance exception of type 'System.NotSupportedException' occurred in PresentationFramework.dll
A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
System.Windows.Data Information: 41 : BindingExpression path error: 'LineValueList' property not found for 'object' because data item is null.  This could happen because the data provider has not produced any data yet. BindingExpression:Path=LineValueList; DataItem=null; target element is 'LineSeries' (Name=''); target property is 'ItemsSource' (type 'IEnumerable')
System.Windows.Data Information: 20 : BindingExpression cannot retrieve value due to missing information. BindingExpression:Path=LineValueList; DataItem=null; target element is 'LineSeries' (Name=''); target property is 'ItemsSource' (type 'IEnumerable')
System.Windows.Data Information: 21 : BindingExpression cannot retrieve value from null data item. This could happen when binding is detached or when binding to a Nullable type that has no value. BindingExpression:Path=LineValueList; DataItem=null; target element is 'LineSeries' (Name=''); target property is 'ItemsSource' (type 'IEnumerable')

<chartingToolkit:LineSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding Path=LineValueList,IsAsync=True,FallbackValue={x:Null}}">

Questions I have: 我有问题:

  1. Are these messages worrisome? 这些消息令人担忧吗? A lot of my end users have older machines (and refuse to upgrade -.-) so I've been trying to maximize performance. 我的许多最终用户都拥有较旧的计算机(并且拒绝升级-.-),因此我一直在尝试使性能最大化。
  2. Is it safe to create dummy base types and reference them from App.xaml? 创建虚拟基本类型并从App.xaml引用它们是否安全?
  3. I datatemplate most of these lists, is that causing this? 我对这些列表中的大多数进行了数据模板处理,这是造成这种情况的原因吗?

Thanks in advance. 提前致谢。

You can use a PriorityBinding to bind to dummy datasources while your real source is loading. 您可以在加载真实数据源时使用PriorityBinding绑定到虚拟数据源。 I hope this helps. 我希望这有帮助。

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

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