Zach Leighton
Zach Leighton

Reputation: 1941

Dummy FallbackValue for IEnumerable Asynchronous

I am trying to debug some of the databinding/performance issues in my MVVM program (Josh Smith based). 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.

However, I am noticing a lot of messages being output from ItemsSource bindings on the fallback values. 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}.

Note: This is happening in many spots not just the chartingToolkit controls

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?
  3. I datatemplate most of these lists, is that causing this?

Thanks in advance.

Upvotes: 1

Views: 980

Answers (1)

Dtex
Dtex

Reputation: 2623

You can use a PriorityBinding to bind to dummy datasources while your real source is loading. I hope this helps.

Upvotes: 1

Related Questions