You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following binding expression: {calc:Binding 'MessagesFiltered.Count > 0 ? MessagesFiltered[0] : null'}
When MessagesFiltered is empty, I see in the binding log the message below, which is exactly what the above binding expression tried to avoid.
System.Windows.Data Warning: 17 : Cannot get 'Item[]' value (type 'LogMessageWithSource') from 'MessagesFiltered' (type 'ObservableCollection`1'). BindingExpression:Path=MessagesFiltered[0]; DataItem='LogMessagesViewModel' (HashCode=50930930); target element is 'Button' (Name=''); target property is 'CommandParameter' (type 'Object') ArgumentOutOfRangeException:'System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index'
Is there the possibility to introduce lazy evaluation in such circumstances, or at least improve the error handling?
(Note: I also tried using a converter calling Enumerable.FirstOrDefault(), but then you lose the change tracking.)
The text was updated successfully, but these errors were encountered:
I'm having the same issue. Can't seem to figure out how to look at a property in an array, without it throwing up errors. {c:Binding 'Items.Count > 0 and !Items[0].SomeBool'} behaves the same: it's functional, but it prints an ArgumentOutOfRangeException.
Consider the following binding expression:
{calc:Binding 'MessagesFiltered.Count > 0 ? MessagesFiltered[0] : null'}
When
MessagesFiltered
is empty, I see in the binding log the message below, which is exactly what the above binding expression tried to avoid.Is there the possibility to introduce lazy evaluation in such circumstances, or at least improve the error handling?
(Note: I also tried using a converter calling
Enumerable.FirstOrDefault()
, but then you lose the change tracking.)The text was updated successfully, but these errors were encountered: