ComponentOne Basic Library for UWP
Basic Library Overview / ListBox for UWP / Top Tips
In This Topic
    Top Tips
    In This Topic

    These tips will help you maximize your performance while using any of the ListBox controls.

    In order to avoid making the layout heavier, the PreviewTemplate can be used to render a lighter template during preview states, such as while zooming and scrolling fast. For example you could display a thumbnail image in the PreviewTemplate and display the larger image in the full ItemTemplate.

    C#
    Copy Code
    <Xaml:C1ListBox x:Name="listBox"
                      ItemsSource="{Binding}"               
                      RefreshWhileScrolling="False">
        <Xaml:C1ListBox.PreviewItemTemplate>
            <DataTemplate>
                <Grid Background="Gray">
                    <Image Source="{Binding Thumbnail}" Stretch="UniformToFill"/>
                </Grid>
            </DataTemplate>
        </Xaml:C1ListBox.PreviewItemTemplate>
        <Xaml:C1ListBox.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Image Source="{Binding Content}" Stretch="UniformToFill"/>
                </Grid>
            </DataTemplate>
        </Xaml:C1ListBox.ItemTemplate>
    </Xaml:C1ListBox>
    

     

    These coefficient values determine what size of items outside the viewport to render in advance. The larger the value the more quickly off-screen items will appear to render, but the slower the control will take on each layout pass. For example, if set to 0.5 the view port will be enlarged to take up a half screen more at both sides of the original view port.

    Determines whether the view port is refreshed while scrolling. If set to false items will appear blank or say “Loading” while the user scrolls real fast until they stop and allow items to render.

    See Also