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.

Solution: Working with data binding

Solution: Working with data binding - .NET MAUI Tutorial

From the course: .NET MAUI: Beyond the Basics

Solution: Working with data binding

(upbeat music) - We had two problems to solve for our exercise. The first was to show the city, state and postal code in a single label view. The most direct way to do this is using a multi binding value converter. We can feed all three fields into the value converter and feed back the formatted string to be displayed in the label. So I created a folder called value converters and you can see, I created an address converter. And the address converter implements the multi value converter interface. And in the convert method, you can see that the array values comes in and we check to see if we've got a total of three values passed in and make sure they're not null. And if they are, we just return back an error message it says unable to retrieve address. We take the city, state and postal code, and then we go in and if any of 'em are no once again, return an error message. Otherwise we format it for display and return it…

Contents