Using data binding
When building graphical UIs, you will often want to bind a property of one control to another, or to some data.
Binding to elements
The simplest type of binding is between two elements. One element acts as a source for a value and the other elements acts as the target.
Let’s take the following steps:
- In
CategoriesPage.xaml
, under the existing button in the vertical stack layout, add a label for instructions, another label to show the current degree of rotation, a slider for selecting a rotation, and a rainbow square to rotate, as shown highlighted in the following markup:<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Northwind.Maui.Client.CategoriesPage" Background="{StaticResource Rainbow}" ...