Reputation: 784
I have a simple Grid in which i bind the Row height to an array member. But the content may be cleared in case of wrong entries from the user, that the array index becomes invalid. Therefore, I set the FallbackValue to a default value. But this doesn't seem to work. In the binding, I use a converter which converts a custom type to the required Double. But that should not be the source of the problem.
<RowDefinition Name="Row1" Height="{Binding Path=item[0].value, Converter={conv:ItemValueToRowHeight}, FallbackValue=20}"/>
The debug output shows me that the wpf binding system still wants the array item, even if there are no items:
System.Windows.Data Warning: 17 : Cannot get 'Item[]' value ...
Any ideas ?
Upvotes: 2
Views: 593
Reputation: 26308
Remarks
A binding returns a value successfully if:
The path to the binding source resolves successfully.
The value converter, if any, is able to convert the resulting value.
The resulting value is valid for the binding target (target) property.
http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.fallbackvalue.aspx
Make your converter return DependencyProperty.UnsetValue
Upvotes: 0