zumero/DataGrid

Cell clipping problem when scrolling

Opened this issue · 1 comments

Found a problem wherein scrolling, apparently when other controls are present, is "overwriting" the other controls because the cells are not being clipped properly.

The rowheight should be larger than the header height to see this problem easily. Here's the code for XamlTest.xaml that reproduces the problem. Uncomment the Grid stuff to see it flow out in the horizontal direction as well. Originally seen on Android.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="clr-namespace:Zumero;assembly=Zumero.DataGrid"
             xmlns:a="clr-namespace:demo;assembly=demo"
                       x:Class="demo.xaml.XamlTest">
     <StackLayout>
    <!--<Button x:Name="btnClickMe" Text="Click Me" />
    <Button x:Name="btnAlsoClickMe" Text="Also click me" />
         <Grid VerticalOptions = "FillAndExpand">
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="*" />
                 <ColumnDefinition Width="3*" />
             </Grid.ColumnDefinitions>-->
             <Label Grid.Column="0" Text="No cells should be drawn over this label while scrolling" BackgroundColor="Blue" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
             <d:DataGrid Grid.Column="1" x:Name="datagrid" SelectionMode="Row" BackgroundColor="Pink" ColumnSpacing="2" RowSpacing="2" RowHeight="100" HeaderHeight="50" VerticalOptions = "FillAndExpand">

                 <d:DataGrid.FrozenColumn>
                     <d:Column Width="80">
                         <d:Column.HeaderView>
                             <Label Text="Corner" BackgroundColor="Yellow"></Label>
                         </d:Column.HeaderView>
                         <d:Column.Template>
                             <DataTemplate>
                                 <Label Text="{Binding Spanish}" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                             </DataTemplate>
                         </d:Column.Template>
                     </d:Column>
                 </d:DataGrid.FrozenColumn>

                 <d:DataGrid.Columns>

                     <d:Column Width="100">
                         <d:Column.HeaderView>
                             <Label Text="English" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                         </d:Column.HeaderView>
                         <d:Column.Template>
                             <DataTemplate>
                                 <Label Text="{Binding English}" BackgroundColor="White" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                             </DataTemplate>
                         </d:Column.Template>
                     </d:Column>

                     <d:Column Width="100">
                         <d:Column.HeaderView>
                             <Label Text="Spanish" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                         </d:Column.HeaderView>
                         <d:Column.Template>
                             <DataTemplate>
                                 <Label Text="{Binding Spanish}" BackgroundColor="{Binding SpanishBackgroundColor}" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                             </DataTemplate>
                         </d:Column.Template>
                     </d:Column>

                     <d:Column Width="100">
                         <d:Column.HeaderView>
                             <Label Text="Pic" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                         </d:Column.HeaderView>
                         <d:Column.Template>
                             <DataTemplate>
                                 <Image Source="{Binding ImageName}"/>
                             </DataTemplate>
                         </d:Column.Template>
                     </d:Column>

                     <d:Column Width="200">
                         <d:Column.HeaderView>
                             <Label Text="Button" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                         </d:Column.HeaderView>
                         <d:Column.Template>
                             <DataTemplate>
                                 <a:myButton BackgroundColor="Green" TextColor="White" Font="Bold,18" Text="{Binding ButtonText}" OneAction="{Binding Action}"/>
                             </DataTemplate>
                         </d:Column.Template>
                     </d:Column>

                     <d:Column Width="100">
                         <d:Column.HeaderView>
                             <Label Text="X" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                         </d:Column.HeaderView>
                         <d:Column.Template>
                             <DataTemplate>
                                 <Entry Text="{Binding X}"></Entry>
                             </DataTemplate>
                         </d:Column.Template>
                     </d:Column>

                     <d:Column Width="100">
                         <d:Column.HeaderView>
                             <Label Text="X * 2" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                         </d:Column.HeaderView>
                         <d:Column.Template>
                             <DataTemplate>
                                 <Label Text="{Binding DoubleX}" BackgroundColor="White" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
                             </DataTemplate>
                         </d:Column.Template>
                     </d:Column>
                 </d:DataGrid.Columns>
             </d:DataGrid>
<!--         </Grid>-->
    </StackLayout>
</ContentPage>

Regression? Seems unlikely this problem has been there all along. But maybe...