WPF pre-displays the list without actually displaying

Is there a way to “pre-render” a list in WPF without actually displaying it to the user? I have a list that runs quite slowly (a few seconds) when first displayed to the user.

I would like to do a preliminary rendering / preliminary drawing of the list so that it would not be visible for a few seconds to display the list for users. I would like this to happen during the launch of the application - while my splash screen is displayed.

What is the best way to do this?

EDIT:

Here is my list item style. As you can see, the type of target is a button. The button also has the RoutedEvent (Command) function installed on it.

<Style x:Key="Button_ProductFinder_Item" TargetType="Button">
    <Setter Property="Control.Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">

                <Grid Width="690" Height="181"   >

                    <Image Name="Up" Source="{StaticResource Img_ProductFinder_FriendUp}" Stretch="Uniform"/>
                    <Image Name="Down" Source="{StaticResource Img_ProductFinder_FriendDn}" Visibility="Hidden" Stretch="Uniform"/>

                    <Canvas Name="Clip" ClipToBounds="True" Height="162" Width="175" HorizontalAlignment="Left" Margin="0,10,0,0" >
                        <Image Name="DynamicFriend"  Stretch="UniformToFill" Canvas.Left="16" Canvas.Top="-10" HorizontalAlignment="Left"  Source="{Binding ImageSource}" Height="162" Width="162" />
                        <Canvas.RenderTransform>
                            <TransformGroup>
                                <TranslateTransform />
                            </TransformGroup>
                        </Canvas.RenderTransform>
                    </Canvas>

                    <TextBlock Name="DynamicName" Margin="210,69,0,0"  Style="{StaticResource ButtonFriend_Textstyle}"
                                   TextWrapping="Wrap" HorizontalAlignment="Left" Width="440" VerticalAlignment="Stretch" Height="Auto" 
                                   Text="{Binding ProductName}"  />
                </Grid>

                <ControlTemplate.Triggers>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="Up" Property="Visibility" Value="Hidden"/>
                        <Setter TargetName="Down" Property="Visibility" Value="Visible"/>
                        <Setter TargetName="Clip" Property="RenderTransform">
                            <Setter.Value>
                                <TransformGroup>
                                    <TranslateTransform Y="2"/>
                                </TransformGroup>
                            </Setter.Value>
                        </Setter>
                        <Setter TargetName="DynamicName" Property="RenderTransform">
                            <Setter.Value>
                                <TransformGroup>
                                    <TranslateTransform Y="2"/>
                                </TransformGroup>
                            </Setter.Value>
                        </Setter>
                        <Setter TargetName="DynamicName" Property="Foreground" Value="#FFFFFF"/>
                        <Trigger.EnterActions>
                            <ctrls:ButtonSoundPlayerAction SoundFile="buttonclick.wav"/>
                        </Trigger.EnterActions>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
+3
2
  • , . . db, , ( perforamnce WPF).

  • ? 5000 . , 4.0 , . ?

  • , rndering? wpf, , .

+1

( , ), , , , .

, .

  • , , .
  • , , .
  • , .

0

Source: https://habr.com/ru/post/1781262/


All Articles