You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/Behaviors/samples/ItemsView Behaviors.md
+10-43Lines changed: 10 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -11,54 +11,21 @@ discussion-id: 532
11
11
issue-id: 0
12
12
icon: assets/icon.png
13
13
---
14
+
The new control `ItemsView` which can replace `ListView`&`GridView`, does not support `ISupportIncrementalLoading`.
14
15
15
-
<!-- To know about all the available Markdown syntax, Check out https://docs.microsoft.com/contribute/markdown-reference -->
16
-
<!-- Ensure you remove all comments before submission, to ensure that there are no formatting issues when displaying this page. -->
17
-
<!-- It is recommended to check how the Documentation will look in the sample app, before Merging a PR -->
18
-
<!-- **Note:** All links to other docs.microsoft.com pages should be relative without locale, i.e. for the one above would be /contribute/markdown-reference -->
19
-
<!-- Included images should be optimized for size and not include any Intellectual Property references. -->
16
+
Here are some Behaviors to help you make `ItemsView` support `ISupportIncrementalLoading`.
20
17
21
-
<!-- Be sure to update the discussion/issue numbers above with your Labs discussion/issue id numbers in order for UI links to them from the sample app to work. -->
18
+
## NeedMoreItemTriggerBehaviorSample
22
19
23
-
# ItemsView Behaviors
24
-
25
-
TODO: Fill in information about this experiment and how to get started here...
26
-
27
-
## Custom Control
28
-
29
-
You can inherit from an existing component as well, like `Panel`, this example shows a control without a
30
-
XAML Style that will be more light-weight to consume by an app developer:
31
-
32
-
>
33
-
34
-
## Templated Controls
35
-
36
-
The Toolkit is built with templated controls. This provides developers a flexible way to restyle components
37
-
easily while still inheriting the general functionality a control provides. The examples below show
38
-
how a component can use a default style and then get overridden by the end developer.
39
-
40
-
TODO: Two types of templated control building methods are shown. Delete these if you're building a custom component.
41
-
Otherwise, pick one method for your component and delete the files related to the unchosen `_ClassicBinding` or `_xBind`
42
-
classes (and the custom non-suffixed one as well). Then, rename your component to just be your component name.
43
-
44
-
The `_ClassicBinding` class shows the traditional method used to develop components with best practices.
45
-
46
-
### Implict style
20
+
This trigger behavior can excute actions when the `ItemsView` scrolling to bottom.
21
+
You can customize the loading behavior through actions, but note that you may need to debounce manually.
47
22
48
23
> [!SAMPLE NeedMoreItemTriggerBehaviorSample]
49
24
50
-
> [!SAMPLE LoadMoreItemBehaviorSample]
51
-
52
-
### Custom style
53
-
54
-
55
-
## Templated Controls with x:Bind
56
-
57
-
This is an _experimental_ new way to define components which allows for the use of x:Bind within the style.
58
-
59
-
### Implict style
60
-
61
-
62
-
### Custom style
25
+
## LoadMoreItemBehaviorSample
63
26
27
+
If you don't have complex loading requirements, you can use this behavior.
28
+
It automatically calls `ISupportIncrementalLoading.LoadMoreItemsAsync` when the `ItemsSource` changes, in addition to when `ItemsView` scrolls to the bottom.
29
+
Besides, this behavior has a built-in debounce function.
[ToolkitSample(id:nameof(LoadMoreItemBehaviorSample),"LoadMoreItemBehavior",description:$"A sample for showing how to create and use a LoadMoreItemBehavior.")]
[ToolkitSample(id:nameof(NeedMoreItemTriggerBehaviorSample),"NeedMoreItemTriggerBehavior",description:$"A sample for showing how to create and use a NeedMoreItemTriggerBehavior.")]
/// <see cref="ItemsRepeater.SizeChanged"/> is the key to continuous loading.
169
-
/// When new data is loaded, it makes the <see cref="Microsoft.UI.Xaml.Controls.ItemsRepeater"/> of the <see cref="FrameworkElement.ActualHeight"/> larger,
169
+
/// When new data is loaded, it makes the <see cref="ItemsRepeater"/> of the <see cref="FrameworkElement.ActualHeight"/> larger,
170
170
/// Or when the <see cref="ItemsView.ItemsSource"/> is changed to a different source or set for the first time, <see cref="FrameworkElement.ActualHeight"/> becomes 0.
171
171
/// This method can reload the data.
172
172
/// </remarks>
@@ -193,7 +193,7 @@ public async Task TryRaiseLoadMoreRequestedAsync()
0 commit comments