Training
Module
Create a UI That Uses Data Binding in .NET MAUI. - Training
Create a UI with data binding. Your UI automatically updates based on the latest data, while the data updates in response to changes in the UI.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This example shows how to display a column of CheckBox controls in a ListView control that uses a GridView.
To create a column that contains CheckBox controls in a ListView, create a DataTemplate that contains a CheckBox. Then set the CellTemplate of a GridViewColumn to the DataTemplate.
The following example shows a DataTemplate that contains a CheckBox. The example binds the IsChecked property of the CheckBox to the IsSelected property value of the ListViewItem that contains it. Therefore, when the ListViewItem that contains the CheckBox is selected, the CheckBox is checked.
<DataTemplate x:Key="FirstCell">
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Path=IsSelected,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"/>
</StackPanel>
</DataTemplate>
The following example shows how to create a column of CheckBox controls. To make the column, the example sets the CellTemplate property of the GridViewColumn to the DataTemplate.
<GridViewColumn CellTemplate="{StaticResource FirstCell}"
Width="30"/>
.NET Desktop feedback feedback
.NET Desktop feedback is an open source project. Select a link to provide feedback:
Training
Module
Create a UI That Uses Data Binding in .NET MAUI. - Training
Create a UI with data binding. Your UI automatically updates based on the latest data, while the data updates in response to changes in the UI.