Completed
Last Updated: 14 Sep 2022 10:08 by ADMIN
Release 3.0.0
Derrick
Created on: 18 Aug 2022 08:38
Category: DataGrid
Type: Bug Report
0
DataGrid:[WinUI] Items do not invalidate correctly when changing pages

I am using NavigationPages and Dependency Injection (for the Pages and ViewModels) to navigate (not AppShell).

    <Grid RowDefinitions="*,100">

        <telerik:RadDataGrid x:Name="grdRegisters"
                             RowHeight="50"
                             Style="{StaticResource ReadOnlyGridStyle}"
                             ItemsSource="{Binding Registers}"
                             SelectionStyle="{StaticResource SelectedRowBackgroundStyle}"
                             RowBackgroundStyle="{StaticResource RowBackgroundStyle}"
                             AlternateRowBackgroundStyle="{StaticResource AltRowBackgroundStyle}"
                             SelectedItem="{Binding SelectedRegister, Mode=TwoWay}">
            <telerik:RadDataGrid.Columns>
                <telerik:DataGridTemplateColumn HeaderText=""
                                                SizeMode="Fixed"
                                                Width="50">
                    <telerik:DataGridTemplateColumn.CellContentTemplate>
                        <DataTemplate x:DataType="RegisterModel">
                            <Label FontFamily="FASolid" 
                                   HorizontalOptions="Center"
                                   VerticalOptions="Center"
                                   Text="&#xf005;" 
                                   IsVisible="{Binding IsCurrentRegister, Mode=OneTime}"/>
                        </DataTemplate>
                    </telerik:DataGridTemplateColumn.CellContentTemplate>
                </telerik:DataGridTemplateColumn>

                <telerik:DataGridTemplateColumn HeaderText="Shift Date">
                    <telerik:DataGridTemplateColumn.CellContentTemplate>
                        <DataTemplate x:DataType="RegisterModel">
                            <Label Style="{StaticResource GridCellLabelStyle}" 
                                   Text="{Binding Date, Converter={StaticResource ToLocalTimeConverter}, StringFormat='{}{0:d}'}"/>
                        </DataTemplate>
                    </telerik:DataGridTemplateColumn.CellContentTemplate>
                </telerik:DataGridTemplateColumn>

                <telerik:DataGridTemplateColumn HeaderText="Shift Name">
                    <telerik:DataGridTemplateColumn.CellContentTemplate>
                        <DataTemplate x:DataType="RegisterModel">
                            <Label Style="{StaticResource GridCellLabelStyle}" 
                                   Text="{Binding Shift.Name}"/>
                        </DataTemplate>
                    </telerik:DataGridTemplateColumn.CellContentTemplate>
                </telerik:DataGridTemplateColumn>

                <telerik:DataGridTemplateColumn HeaderText="Start Time">
                    <telerik:DataGridTemplateColumn.CellContentTemplate>
                        <DataTemplate x:DataType="RegisterModel">
                            <Label Style="{StaticResource GridCellLabelStyle}" 
                                   Text="{Binding StartTime, Converter={StaticResource ToLocalTimeConverter}, StringFormat='{}{0:t}'}"/>
                        </DataTemplate>
                    </telerik:DataGridTemplateColumn.CellContentTemplate>
                </telerik:DataGridTemplateColumn>

                <telerik:DataGridTemplateColumn HeaderText="End Time">
                    <telerik:DataGridTemplateColumn.CellContentTemplate>
                        <DataTemplate x:DataType="RegisterModel">
                            <Label Style="{StaticResource GridCellLabelStyle}" 
                                   Text="{Binding EndTime, Converter={StaticResource ToLocalTimeConverter}, StringFormat='{}{0:t}'}"/>
                        </DataTemplate>
                    </telerik:DataGridTemplateColumn.CellContentTemplate>
                </telerik:DataGridTemplateColumn>


            </telerik:RadDataGrid.Columns>
        </telerik:RadDataGrid>

        <HorizontalStackLayout Grid.Row="1">
            <Button Text="Resume"
                    IsEnabled="{Binding SelectedRegister, Converter={StaticResource IsNotNullConverter}}"
                    Command="{Binding ResumeShiftCommand}"/>

            <Button Text="Refresh"
                    Command="{Binding RefreshCommand}"/>

        </HorizontalStackLayout>
        
    </Grid>

On initial Refresh, all items are visible in the DataGrid

I navigate forward and then back (PopToRoot), the DataGrid appears empty, although the vertical scroll appears like there are items.

If I tap Refresh, items become visible, but only above the first fold.

If i resize the window vertically, items will appear and disappear depending on the height of the window. (see attached video)

0 comments