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: docs/extensions/ScrollViewerExtensions.md
+58-2Lines changed: 58 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: ScrollViewerEx provides a simple way to manage Margin for any Scrol
5
5
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, ScrollViewer, extentions
6
6
---
7
7
8
-
# ScrollViewer extentions
8
+
# ScrollViewer extensions
9
9
10
10
The [ScrollViewerExtensions](https://docs.microsoft.com/en-us/dotnet/api/microsoft.toolkit.uwp.ui.extensions.scrollviewerextensions) provide extension methods to improve your ScrollViewer implementation.
11
11
@@ -115,7 +115,7 @@ MiddleClickScrolling allows you to scroll by click middle mouse button (scroll w
115
115
116
116
### Edit Existing Resource File
117
117
118
-
You can easily edit the existing resource file to customise the cursor depending upon your needs.
118
+
You can easily edit the existing resource file to customize the cursor depending upon your needs.
119
119
120
120
1. Follow the above steps to add the resource file
121
121
2. Open MiddleClickScrolling-CursorType.res file in Visual Studio
@@ -128,6 +128,62 @@ You can easily edit the existing resource file to customise the cursor depending
128
128
| -- | -- | -- |
129
129
| EnableMiddleClickScrolling | bool | Set `true` to enable middle click scrolling |
130
130
131
+
## Expression animations
132
+
133
+
The `StartExpressionAnimation` methods provide a way to easily start a composition expression animation to sync a `ScrollViewer` instance with another control. This binds the manipulation status on a `ScrollViewer` property set with either the translation or the offset of another visual element, to follow or mirror the motion in the source `ScrollViewer`.
134
+
135
+
### Example
136
+
137
+
```xml
138
+
<Grid>
139
+
140
+
<!--This is a ListView we can use to display a series of items. It will
141
+
contain the ScrollViewer that will be targeted by the expression animation.-->
142
+
<ListViewName="listView">
143
+
<ListView.ItemTemplate>
144
+
<DataTemplate>
145
+
<ImageWidth="100"
146
+
Height="100"
147
+
Source="ms-appx:///Assets/ToolkitLogo.png" />
148
+
</DataTemplate>
149
+
</ListView.ItemTemplate>
150
+
</ListView>
151
+
152
+
<!--This is the panel that will be animated in sync with the main ScrollViewer control
153
+
inside the ListView in the page, using the ScrollViewerExtensions leveraging composition
154
+
ExpressionAnimations. Note how the panel is not inside the ListView, but it's just
155
+
rendering "fixed" items right on top of the ListView. We can use the expression animation
156
+
to "bind" the scrolling of the ListView and keep the panel "in sync" with it.-->
[ScrollViewerExtensions sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions). You can [see this in action](uwpct://Extensions?sample=ScrollViewerExtensions) in the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp).
0 commit comments