From the course: .NET MAUI: Beyond the Basics

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

When data binding goes wrong

When data binding goes wrong - .NET MAUI Tutorial

From the course: .NET MAUI: Beyond the Basics

When data binding goes wrong

- [Instructor] Sometimes data binding doesn't go as planned. Perhaps a network call fails and we don't get the data we need, or maybe an object doesn't have the value we expect. These situations, if left unhandled, can create an unsatisfactory experience for the user. To help with this, bindings have two properties to display information to the user when the bindings don't work. The properties handle subtly different scenarios but work much the same. The FallbackValue is used when there is a problem with the binding and it errors out. This can happen due to a problem with the value that the property's bound to or perhaps the property isn't found at all. How the FallbackValue is evaluated depends on the type of binding. If it is bound to a string value then it will expect a string. If an image, a supplied file name will attempt to be loaded. The TargetNullValue works in a very similar way when it comes to the value…

Contents