-
Couldn't load subscription status.
- Fork 1.4k
SmoothScrollIntoView ListView Extension #3222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
michael-hawker
merged 14 commits into
CommunityToolkit:main
from
Vijay-Nirmal:SmoothScrollIntoView
Jul 15, 2021
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5aa3a84
Added SmoothScrollIntoView ListViewBase Extension Method
Vijay-Nirmal 54944a7
Use SampleCommand class dont change DataContext
Rosuavio 24ae708
Fix issue when index is greater than Count and Big Fix for Sample Page
Vijay-Nirmal af4d202
Updated Default ItemPlacement value
Vijay-Nirmal 60fc7c5
Fixes for Pipeline build failed
Vijay-Nirmal 2531a00
Review changes
Vijay-Nirmal 8e6ef0a
Review Changes - Files Reorg
Vijay-Nirmal 2ebe4b2
Make scrool controls part of the sample
Rosuavio 91367b8
Name SmoothScroll methods with Async
Rosuavio 65af1d2
Remove over sepcified naming
Rosuavio 05e250c
Use smooth scrool controls in static xaml file
Rosuavio e46bdde
Raname ItemPlacement to ScrollItemPlacement
Rosuavio c6212fc
Sample fixes
Rosuavio 0687cbf
Merge branch 'main' into SmoothScrollIntoView
michael-hawker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 6 additions & 29 deletions
35
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ListViewExtensions/ListViewExtensionsCode.bind
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,9 @@ | ||
| <Page | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| xmlns:ui="using:Microsoft.Toolkit.Uwp.UI" | ||
| mc:Ignorable="d"> | ||
| <GridView x:Name="MyGridView"/> | ||
|
|
||
| <Page.Resources> | ||
| <DataTemplate x:Name="NormalTemplate"> | ||
| <TextBlock Text="{Binding Title}" Foreground="Green"/> | ||
| </DataTemplate> | ||
| using Microsoft.Toolkit.Uwp.UI; | ||
|
|
||
| <DataTemplate x:Name="AlternateTemplate"> | ||
| <TextBlock Text="{Binding Title}" Foreground="Red"/> | ||
| </DataTemplate> | ||
| </Page.Resources> | ||
| // Scrolling with index | ||
| await MyGridView.SmoothScrollIntoViewWithIndexAsync(index: int, itemPlacement: ScrollItemPlacement, disableAnimation: bool, scrollIfVisibile: bool, additionalHorizontalOffset: int, additionalVerticalOffset: int); | ||
|
|
||
| <Grid> | ||
|
|
||
| <ListView | ||
| x:Name="SampleListView" | ||
| Margin="12" | ||
| ItemTemplate="{StaticResource NormalTemplate}" | ||
| IsItemClickEnabled="True" | ||
| ui:ListViewExtensions.Command="{Binding SampleCommand}" | ||
| ui:ListViewExtensions.AlternateColor="#33AAAAAA" | ||
| ui:ListViewExtensions.AlternateItemTemplate="{StaticResource AlternateTemplate}" | ||
| ui:ListViewExtensions.ItemContainerStretchDirection="Both"> | ||
| </ListView> | ||
| </Grid> | ||
| </Page> | ||
| // Scrolling with item | ||
| await MyGridView.SmoothScrollIntoViewWithItemAsync(item: object, itemPlacement: ScrollItemPlacement, disableAnimation: bool, scrollIfVisibile: bool, additionalHorizontalOffset: int, additionalVerticalOffset: int); |
63 changes: 50 additions & 13 deletions
63
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ListViewExtensions/ListViewExtensionsPage.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,69 @@ | ||
| <Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.ListViewExtensionsPage" | ||
| <Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.ListViewExtensionsPage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages" | ||
| xmlns:ui="using:Microsoft.Toolkit.Uwp.UI" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| mc:Ignorable="d"> | ||
|
|
||
| <Page.Resources> | ||
| <local:SampleCommand x:Key="SampleCommand" /> | ||
|
|
||
| <DataTemplate x:Name="NormalTemplate"> | ||
| <TextBlock Foreground="Green" | ||
| Text="{Binding Title}" /> | ||
| <TextBlock Text="{Binding}" Foreground="Green" VerticalAlignment="Center" FontWeight="Bold"></TextBlock> | ||
| </DataTemplate> | ||
|
|
||
| <DataTemplate x:Name="AlternateTemplate"> | ||
| <TextBlock Foreground="Red" | ||
| Text="{Binding Title}" /> | ||
| <TextBlock Text="{Binding}" Foreground="Red" VerticalAlignment="Center" FontWeight="Bold"></TextBlock> | ||
| </DataTemplate> | ||
| </Page.Resources> | ||
|
|
||
| <Grid> | ||
| <Grid.ColumnDefinitions> | ||
| <ColumnDefinition Width="*" /> | ||
| <ColumnDefinition Width="Auto" /> | ||
| </Grid.ColumnDefinitions> | ||
| <Grid x:Name="XamlRoot" Grid.Column="0" Margin="12"> | ||
| <ListView x:Name="SampleListView" | ||
| ui:ListViewExtensions.AlternateColor="#33AAAAAA" | ||
| ui:ListViewExtensions.AlternateItemTemplate="{StaticResource AlternateTemplate}" | ||
| ui:ListViewExtensions.Command="{StaticResource SampleCommand}" | ||
| ui:ListViewExtensions.ItemContainerStretchDirection="Both" | ||
| IsItemClickEnabled="True" | ||
| ItemTemplate="{StaticResource NormalTemplate}" /> | ||
| </Grid> | ||
|
|
||
| <ListView x:Name="SampleListView" | ||
| Margin="12" | ||
| ui:ListViewExtensions.AlternateColor="#33AAAAAA" | ||
| ui:ListViewExtensions.AlternateItemTemplate="{StaticResource AlternateTemplate}" | ||
| ui:ListViewExtensions.Command="{Binding SampleCommand}" | ||
| ui:ListViewExtensions.ItemContainerStretchDirection="Both" | ||
| IsItemClickEnabled="True" | ||
| ItemTemplate="{StaticResource NormalTemplate}" /> | ||
| <StackPanel Grid.Column="1" Margin="5,10,10,0" Width="200"> | ||
| <TextBlock Text="Smooth Scroll Settings" FontSize="{StaticResource TextStyleLargeFontSize}" Margin="0,0,0,10"/> | ||
| <TextBox x:Name="IndexInput" | ||
| Header="Index" | ||
| InputScope="Number" | ||
| Text="100" /> | ||
| <ComboBox x:Name="ItemPlacementInput" | ||
| Header="Item Placement" | ||
| SelectedIndex="0"> | ||
| <x:String>Default</x:String> | ||
| <x:String>Left</x:String> | ||
| <x:String>Top</x:String> | ||
| <x:String>Center</x:String> | ||
| <x:String>Right</x:String> | ||
| <x:String>Bottom</x:String> | ||
| </ComboBox> | ||
| <CheckBox x:Name="DisableAnimationInput" | ||
| Content="Disable Animation" | ||
| IsChecked="False" /> | ||
| <CheckBox x:Name="ScrollIfVisibileInput" | ||
| Content="Scroll If Visible" | ||
| IsChecked="True" /> | ||
| <TextBox x:Name="AdditionalHorizontalOffsetInput" | ||
| Header="Horizontal Offset" | ||
| InputScope="Number" | ||
| Text="0" /> | ||
| <TextBox x:Name="AdditionalVerticalOffsetInput" | ||
| Header="Vertical Offset" | ||
| InputScope="Number" | ||
| Text="0" /> | ||
| </StackPanel> | ||
| </Grid> | ||
| </Page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ListViewExtensions/ListViewExtensionsXaml.bind
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <Page | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages" | ||
| xmlns:ui="using:Microsoft.Toolkit.Uwp.UI" | ||
| mc:Ignorable="d"> | ||
|
|
||
| <Page.Resources> | ||
| <local:SampleCommand x:Key="SampleCommand" /> | ||
|
|
||
| <DataTemplate x:Name="NormalTemplate"> | ||
| <TextBlock Text="{Binding}" Foreground="Green" VerticalAlignment="Center" FontWeight="Bold"></TextBlock> | ||
| </DataTemplate> | ||
|
|
||
| <DataTemplate x:Name="AlternateTemplate"> | ||
| <TextBlock Text="{Binding}" Foreground="Red" VerticalAlignment="Center" FontWeight="Bold"></TextBlock> | ||
| </DataTemplate> | ||
| </Page.Resources> | ||
| <ListView | ||
| x:Name="SampleListView" | ||
| ItemTemplate="{StaticResource NormalTemplate}" | ||
| IsItemClickEnabled="True" | ||
| ui:ListViewExtensions.Command="{StaticResource SampleCommand}" | ||
| ui:ListViewExtensions.AlternateColor="#33AAAAAA" | ||
| ui:ListViewExtensions.AlternateItemTemplate="{StaticResource AlternateTemplate}" | ||
| ui:ListViewExtensions.ItemContainerStretchDirection="Both"> | ||
| </ListView> | ||
| </Page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.