2012-11-08 38 views
1

Dummy FallbackValue我想在我的MVVM程序(基于Josh Smith)中调试一些数据绑定/性能问题。有很多不同的列表和对象的并发加载,所以我一直在使用isAsync和一些线程来提高性能和网络瓶颈。IEnumerable Asynchronous

但是,我注意到从fallback值上的ItemsSource绑定输出了很多消息。对于命令,我创建了一个禁用命令的哑命令,对于大多数情况,我可以绑定到已知的回退原语类型。当我将一个ItemsSource的后备绑定到{x:Null}时,问题似乎就出现了。

注:这是在许多斑点发生的事情不只是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}}"> 

问题,我有:

  1. 是这些消息令人担忧?我的许多最终用户使用旧版本的机器(并拒绝升级--.-),所以我一直在试图最大化性能。
  2. 创建虚拟基础类型并从App.xaml引用它是否安全?
  3. 我datatemplate这些名单的大部分,这是造成这种?

在此先感谢。

回答

1

在加载真实源时,可以使用PriorityBinding绑定到虚拟数据源。 我希望这可以帮助。

+0

是的,但是什么哑数据源对IEnumerable来说是安全的? –