Jump to: navigation, search

Difference between revisions of "XAML Tips"


(Created page with "== Performance related == === FlipView === When using the FlipView control in your XAML code, it's better to enable [https://docs.microsoft.com/en-us/windows/uwp/debug-test-pe...")
 
Line 1: Line 1:
 +
== Functionality related ==
 +
 +
=== Fit mode ===
 +
If you are using the standard app without XAML customizings, the [[UBIK_WinX_Client_Basics#Fit_Mode|fit mode]] feature should work out of the box.
 +
However, when using a FlipView for displaying documents in your customized XAMLs, you must make sure to include the following binding to the FlipView's ItemTemplate so that the fit modes are properly applied.
 +
 +
<source lang = "xml">
 +
<DataTemplate
 +
    ...
 +
    xmlns:hs="using:UBIK.WinX.HotSpotting.Document">
 +
    ...
 +
    <Grid.Resources>
 +
        ...
 +
        <DataTemplate>
 +
            ...
 +
            <hs:Document
 +
                ...
 +
                FitMode="{Binding DocumentViewModel.FitMode}" />
 +
        </DataTemplate>
 +
    </Grid.Resources>
 +
</DataTemplate>
 +
</source>
 +
 
== Performance related ==
 
== Performance related ==
 +
 
=== FlipView ===
 
=== FlipView ===
 
When using the FlipView control in your XAML code, it's better to enable [https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-gridview-and-listview#ui-virtualization UI virtualization]. The difference in performance gets more obvious as the number of items in the FlipView increases. Here's how to enable it.
 
When using the FlipView control in your XAML code, it's better to enable [https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-gridview-and-listview#ui-virtualization UI virtualization]. The difference in performance gets more obvious as the number of items in the FlipView increases. Here's how to enable it.

Revision as of 08:25, 10 April 2019

Functionality related

Fit mode

If you are using the standard app without XAML customizings, the fit mode feature should work out of the box. However, when using a FlipView for displaying documents in your customized XAMLs, you must make sure to include the following binding to the FlipView's ItemTemplate so that the fit modes are properly applied.

<DataTemplate
   ...
   xmlns:hs="using:UBIK.WinX.HotSpotting.Document">
    ...
    <Grid.Resources>
        ...
        <DataTemplate>
            ...
            <hs:Document
               ...
               FitMode="{Binding DocumentViewModel.FitMode}" />
        </DataTemplate>
    </Grid.Resources>
</DataTemplate>

Performance related

FlipView

When using the FlipView control in your XAML code, it's better to enable UI virtualization. The difference in performance gets more obvious as the number of items in the FlipView increases. Here's how to enable it.

<FlipView
   ...
   VirtualizingStackPanel.VirtualizationMode="Standard">
    <Flipview.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </Flipview.ItemsPanel>
</FlipView>


VirtualizingStackPanel.VirtualizationMode offers two possibilities: Standard & Recycling. In case you are interested, here are their differences.