2012-11-08 42 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來說是安全的? –