FallbackValue property

Binding.FallbackValue property

Gets or sets the value to use when the binding is unable to return a value.


public object FallbackValue { get; set; }

<Binding FallbackValue="fallbackValue" />


XAML Values


An attribute or object element value of the same type as the target property. This varies with each Binding. See the documentation for the property you're binding to and use that XAML syntax for the XAML in your FallbackValue. That property might support attribute syntax for values, or might only support object element syntax. You can also use another Binding or a {StaticResource} markup extension reference to fill the attribute syntax by using an existing object from a ResourceDictionary.

Property value

Type: System.Object [.NET] | Platform::Object [C++]

The value to use when the binding is unable to return a value.


Usually you specify FallbackValue for bindings that display strings in UI. For this case the FallbackValue is also a string. You might want to use a resource so that it's easier to localize this string.

If you do specify a literal string for FallbackValue, you must use alternate quotes for the FallbackValue value within the {Binding} markup extension usage if your string contains spaces, because the {Binding} markup extension usage for an attribute is already within quotes. For example, <object property="{Binding FallbackValue='A literal string'}" />.

If used within a {Binding} markup extension usage, the value for FallbackValue can use any implicit string conversions that are already available to XAML, such as treating 0 as a string for a string binding, or converting enum values. For example, <object property="{Binding Path=Visibility, FallbackValue=Collapsed}" /> is valid because the parser can evaluate the string "Collapsed" and return Visibility.Collapsed as the fallback for a Visibility value.

TargetNullValue is a similar property with similar scenarios. The difference is that a binding uses FallbackValue for cases where the Path doesn't evaluate on the data source at all, or if attempting to set it on the source with a two-way binding throws an exception that's caught by the data binding engine. FallbackValue is also used if the source value is the dependency property sentinel value DependencyProperty.UnsetValue. A binding uses TargetNullValue if the Path and Source do evaluate, but the value found there is null.

You can't set the property values of a Binding object after that binding has been attached to a target element and target property. If you attempt this you'll get a run-time exception.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml::Data [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Data [C++]



See also

XAML data binding sample
Data binding in depth



© 2016 Microsoft