You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.6 KiB

<?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"
xmlns:mylayouts="clr-namespace:ex_BindingToA2dArray_v2.MyLayouts"
x:Class="ex_BindingToA2dArray_v2.MainPage">
<ContentPage.Resources>
<ResourceDictionary>
<x:Double x:Key="verticalSpacing">10</x:Double>
<x:Double x:Key="horizontalSpacing">10</x:Double>
<DataTemplate x:Key="cellTemplate">
<Grid BackgroundColor="DarkSalmon">
<Label Text="{Binding}"
TextColor="Black"
FontSize="Medium"
HorizontalOptions="Fill"
VerticalOptions="Fill"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"/>
</Grid>
</DataTemplate>
</ResourceDictionary>
</ContentPage.Resources>
<mylayouts:MatrixLayout BindableLayout.ItemsSource="{Binding Matrix.FlatMatrix2d}" BackgroundColor="Blue"
BindableLayout.ItemTemplate="{StaticResource cellTemplate}"
NbColumns="{Binding Matrix.NbColumns}" NbRows="{Binding Matrix.NbRows}"
HorizontalSpacing="{StaticResource horizontalSpacing}" VerticalSpacing="{StaticResource verticalSpacing}"
HorizontalOptions="Center" VerticalOptions="Center"
Padding="10" Margin="20"/>
</ContentPage>