Плагин DataGrid не поддерживает такую функцию.
Вариант 1:
Вы можете использовать библиотеку Syncfusion.Xamarin.SfDataGrid из nuget. Доступна docs , и вы можете получить бесплатную лицензию на все наши продукты, выполнив вход в LinkedIn или XING. Отметьте https://www.syncfusion.com/downloads/communitylicense?utm_source=nuget&utm_medium=listing.
Вариант 2:
Фактически, вы можете реализовать такой макет, используя BindableLayout
в xaml
<ScrollView Orientation="Horizontal" >
<StackLayout Orientation="Horizontal" VerticalOptions="CenterAndExpand" HorizontalOptions="StartAndExpand" BindableLayout.ItemsSource="{Binding Teams}">
<!-- Place new controls here -->
<BindableLayout.ItemTemplate>
<DataTemplate>
<Frame Padding="0" Margin="{Binding Margin}">
<Grid RowSpacing="0.1" ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Frame BackgroundColor="{Binding BgColor}" Grid.Row="0" Grid.Column="0" Padding="10,0" BorderColor="Black" >
<Label BackgroundColor="Transparent" Text="{Binding Name}" TextColor="Black" FontSize="20" VerticalTextAlignment="Center"/>
</Frame>
<Frame BackgroundColor="{Binding BgColor}" Grid.Row="1" Grid.Column="0" Padding="10,0" BorderColor="Black" >
<Label BackgroundColor="Transparent" Text="{Binding Win}" TextColor="Black" FontSize="20" VerticalTextAlignment="Center" />
</Frame>
<Frame BackgroundColor="{Binding BgColor}" Grid.Row="2" Grid.Column="0" Padding="10,0" BorderColor="Black" >
<Label Text="{Binding Home}" TextColor="Black" FontSize="20" VerticalTextAlignment="Center"/>
</Frame>
</Grid>
</Frame>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
</ScrollView>
в коде позади
public class MyViewModel
{
public ObservableCollection<Team> Teams { get; set; }
public MyViewModel()
{
Teams = new ObservableCollection<Team>();
Teams.Add(new Team() { Home = "Zone2", Win = "Zone3", Name = "Zone1", Margin = new Thickness(0,0,-10,0),BgColor=Color.LightGray }); ;
Teams.Add(new Team() { Home = "333", Win = "222", Name = "111", Margin = new Thickness(0, 0, -10, 0), BgColor = Color.White });
Teams.Add(new Team() { Home = "333", Win = "222", Name = "111", Margin = new Thickness(0, 0, -10, 0), BgColor = Color.White });
Teams.Add(new Team() { Home = "333", Win = "222", Name = "111", Margin = new Thickness(0, 0, -10, 0), BgColor = Color.White });
Teams.Add(new Team() { Home = "333", Win = "222", Name = "111", Margin = new Thickness(0, 0, -10, 0), BgColor = Color.White });
Teams.Add(new Team() { Home = "444", Win = "555", Name = "666", Margin = new Thickness(0, 0, 0, 0), BgColor = Color.White });
}
}
public class Team
{
public string Name { get; set; }
public string Win { get; set; }
public string Loose { get; set; }
public string Home { get; set; }
public string Percentage { get; set; }
public Color BgColor { get; set; }
public Thickness Margin { get; set; }
}