UI Thread Optimization

Vignesh Govindhan 21 Reputation points
2021-07-19T12:58:20.947+00:00

While loading the below page throw navigation. While clicking navigation item it takes 2 secs and then it navigates. After verfiying and clearing everything in .cs file still the same time persists between navigation. Is it because of more user controls being rendered ?. If so how can i make UI thread accessible without hanging

<Page>

<Grid x:Name="InvoicesViewGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" >
    <Grid x:Name="PrintContainer"  Visibility="{x:Bind ViewModel.IsEditView,Mode=OneWay,Converter={StaticResource BoolToVisibilityReverseConverter}}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="ListColumn" Width="{x:Bind ViewModel.ListWidth,Mode=OneWay}" />
            <ColumnDefinition x:Name="DetailColumn" Width="{x:Bind ViewModel.DetailWidth,Mode=OneWay}" />
        </Grid.ColumnDefinitions>

        <!--Invoices-->
        <Grid>
            <views:InvoicesList ViewModel="{x:Bind ViewModel.List,Mode=OneWay}" />
        </Grid>
        <!--Details-->
        <Grid Grid.Column="1" x:Name="DetailsGrid" Visibility="{x:Bind ViewModel.IsDetailView,Mode=OneWay}">
            <views:InvoiceDetails ViewModel="{x:Bind ViewModel.Details,Mode=OneWay}" />
            <controls:OfflineStateDetail Visibility="{x:Bind ViewModel.IsDataNotAvailableInOffline, Mode=OneWay}"></controls:OfflineStateDetail>
        </Grid>
        <Grid Grid.Column="1" x:Name="EmailGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Visibility="{x:Bind ViewModel.IsEmailView,Mode=OneWay}">
            <views:EmailView  ViewModel="{x:Bind ViewModel.Email,Mode=OneWay}"></views:EmailView>
        </Grid>
        <Grid Grid.Column="{x:Bind ViewModel.PaymentGridColumn, Mode=OneWay}" Grid.ColumnSpan="2" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Visibility="{x:Bind ViewModel.IsPaymentView,Mode=OneWay}">
            <views:PaymentsReceivedEdit  ViewModel="{x:Bind ViewModel.PaymentEdit,Mode=OneWay}"></views:PaymentsReceivedEdit>
        </Grid>
    </Grid>
    <Grid x:Name="EditGrid"  Visibility="{x:Bind ViewModel.IsEditView,Mode=OneWay}" Background="Transparent">
        <views:InvoiceEditView ViewModel="{x:Bind ViewModel.Edit}" Visibility="{x:Bind ViewModel.Edit.IsRetailView,Mode=OneWay,Converter={StaticResource BoolToVisibilityReverseConverter}}" />
        <views:RetailInvoiceView ViewModel="{x:Bind ViewModel.Edit}" Visibility="{x:Bind ViewModel.Edit.IsRetailView,Mode=OneWay}" />
    </Grid>
    <views:ShippingBill x:Name="ShippingBillGrid" ViewModel="{x:Bind ViewModel.ShippingBillViewModel,Mode=OneWay}" Visibility="{x:Bind ViewModel.IsShippingView,Mode=OneWay}"></views:ShippingBill>
</Grid>

</Page>

Universal Windows Platform (UWP)
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.