-
Notifications
You must be signed in to change notification settings - Fork 4
/
ListViewCachingStrategy.xml
110 lines (110 loc) · 8.42 KB
/
ListViewCachingStrategy.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<Type Name="ListViewCachingStrategy" FullName="Microsoft.Maui.Controls.ListViewCachingStrategy">
<TypeSignature Language="C#" Value="public enum ListViewCachingStrategy" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed ListViewCachingStrategy extends System.Enum" />
<TypeSignature Language="DocId" Value="T:Microsoft.Maui.Controls.ListViewCachingStrategy" />
<TypeSignature Language="VB.NET" Value="Public Enum ListViewCachingStrategy" />
<TypeSignature Language="C++ CLI" Value="public enum class ListViewCachingStrategy" />
<TypeSignature Language="F#" Value="type ListViewCachingStrategy = " />
<AssemblyInfo>
<AssemblyName>Microsoft.Maui.Controls</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Enum</BaseTypeName>
</Base>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Flags]</AttributeName>
<AttributeName Language="F#">[<System.Flags>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Enumerates caching strategies for a ListView.</summary>
<remarks>
<para>Application developers can specify one of these values when constructing a <see cref="T:Microsoft.Maui.Controls.ListView" /> to determine whether the List View will minimize their memory footprint and speed execution by recycling list cells, or will instead generate a cell for every item in the list. Currently, the default behavior is to retain item data in their generated cells when they are not needed. (Items are not needed, for example, when they are far enough off screen that their display is not imminent.) This behavior corresponds to a value of <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RetainElement" />. For performance reasons, it is likely that the default behavior will be changed to <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" /> in a future release. In the meantime, for memory and performance reasons, app developers should specify <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" /> when constructing a new List View.</para>
<para>The performance advantage of <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" /> is so great that application developers have been provided with a XAML syntax shortcut for initializing List Views. Instead of <c>x:TypeArguments</c> syntax that specifies a parameter for the <see cref="M:Microsoft.Maui.Controls.ListView.#ctor(Microsoft.Maui.Controls.ListViewCachingStrategy)" /> constructor, XAML for Microsoft.Maui.Controls provides a XAML attribute for a non-existent property that corresponds to the caching strategy argument of the constructor. Application developers can set the <c>CachingStrategy</c> attribute to either of the <c>RecycleElement</c> (preferred) or <c>RetainElement</c> values to choose a caching strategy. For example:</para>
<code lang="XAML"><![CDATA[
<ListView CachingStrategy="RecycleElement" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<!-- ... -->
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>]]></code>
<para>
Note: when developers specify <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" />, <c>OnElementChanged</c> events are not raised when cells are recycled. Instead, the cell is retained and its property values change when the binding context is updated to that of an available cell, <c>OnElementPropertyChanged</c> events are raised. Application developers should remember to listen for the correct events, and should note that their renderers will need to be updated if the default behavior changes to <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" /> in a future release.
</para>
<para>
Note: the UWP platform ignores <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RetainElement" />, because it always uses caching to improve performance. Therefore, if the developer has opted not to use data bindings, they must use <see cref="M:Microsoft.Maui.Controls.ListView.OnBindingContextChanged" /> to update cell data on UWP, because it always behaves as if <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" /> was specified.
</para>
</remarks>
</Docs>
<Members>
<Member MemberName="RecycleElement">
<MemberSignature Language="C#" Value="RecycleElement" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype Microsoft.Maui.Controls.ListViewCachingStrategy RecycleElement = int32(1)" />
<MemberSignature Language="DocId" Value="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" />
<MemberSignature Language="VB.NET" Value="RecycleElement" />
<MemberSignature Language="C++ CLI" Value="RecycleElement" />
<MemberSignature Language="F#" Value="RecycleElement = 1" Usage="Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Maui.Controls</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Maui.Controls.ListViewCachingStrategy</ReturnType>
</ReturnValue>
<MemberValue>1</MemberValue>
<Docs>
<summary>Indicates that unneeded cells will have their binding contexts updated to that of a cell that is needed.</summary>
</Docs>
</Member>
<Member MemberName="RecycleElementAndDataTemplate">
<MemberSignature Language="C#" Value="RecycleElementAndDataTemplate" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype Microsoft.Maui.Controls.ListViewCachingStrategy RecycleElementAndDataTemplate = int32(3)" />
<MemberSignature Language="DocId" Value="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElementAndDataTemplate" />
<MemberSignature Language="VB.NET" Value="RecycleElementAndDataTemplate" />
<MemberSignature Language="C++ CLI" Value="RecycleElementAndDataTemplate" />
<MemberSignature Language="F#" Value="RecycleElementAndDataTemplate = 3" Usage="Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElementAndDataTemplate" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Maui.Controls</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Maui.Controls.ListViewCachingStrategy</ReturnType>
</ReturnValue>
<MemberValue>3</MemberValue>
<Docs>
<summary>Indicates that, in addition to the behavior specified by <see cref="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RecycleElement" />, <see cref="T:Microsoft.Maui.Controls.DataTemplate" /> objects that are selected by a <see cref="T:Microsoft.Maui.Controls.DataTemplateSelector" /> are cached by the data template type.</summary>
</Docs>
</Member>
<Member MemberName="RetainElement">
<MemberSignature Language="C#" Value="RetainElement" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype Microsoft.Maui.Controls.ListViewCachingStrategy RetainElement = int32(0)" />
<MemberSignature Language="DocId" Value="F:Microsoft.Maui.Controls.ListViewCachingStrategy.RetainElement" />
<MemberSignature Language="VB.NET" Value="RetainElement" />
<MemberSignature Language="C++ CLI" Value="RetainElement" />
<MemberSignature Language="F#" Value="RetainElement = 0" Usage="Microsoft.Maui.Controls.ListViewCachingStrategy.RetainElement" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Maui.Controls</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Maui.Controls.ListViewCachingStrategy</ReturnType>
</ReturnValue>
<MemberValue>0</MemberValue>
<Docs>
<summary>Indicates that for every item in the List View's <see cref="P:Microsoft.Maui.Controls.ItemsView`1.ItemsSource" /> property, a single unique element will be constructed from the DataTemplate.</summary>
</Docs>
</Member>
</Members>
</Type>