-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and fix AdvancedScrollWheelBehavior (renamed from SmoothScro…
…llingBehavior)
- Loading branch information
tom-englert
committed
Jul 31, 2024
1 parent
5f1991d
commit a9cf94e
Showing
7 changed files
with
285 additions
and
167 deletions.
There are no files selected for viewing
This file contains 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,105 @@ | ||
<UserControl x:Class="SampleApp.Samples.AdvancedScrollingView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" | ||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" | ||
xmlns:local="clr-namespace:SampleApp.Samples" | ||
xmlns:toms="urn:TomsToolbox" | ||
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:AdvancedScrollingViewModel}"> | ||
<Grid> | ||
<Grid.Resources> | ||
<SolidColorBrush Color="Transparent" x:Key="Background"></SolidColorBrush> | ||
<LinearGradientBrush x:Key="Background1"> | ||
<GradientStop Offset="0.0" Color="Blue" /> | ||
<GradientStop Offset="0.1" Color="Red" /> | ||
<GradientStop Offset="0.2" Color="Blue" /> | ||
<GradientStop Offset="0.3" Color="Red" /> | ||
<GradientStop Offset="0.4" Color="Blue" /> | ||
<GradientStop Offset="0.5" Color="Red" /> | ||
<GradientStop Offset="0.6" Color="Blue" /> | ||
<GradientStop Offset="0.7" Color="Red" /> | ||
<GradientStop Offset="0.8" Color="Blue" /> | ||
<GradientStop Offset="0.9" Color="Red" /> | ||
<GradientStop Offset="1.0" Color="Blue" /> | ||
</LinearGradientBrush> | ||
<VisualBrush x:Key="RepeatingTextBrush" TileMode="Tile" Viewport="0,0,200,74" ViewportUnits="Absolute"> | ||
<VisualBrush.Visual> | ||
<Border Width="200" Height="74" BorderBrush="Transparent" BorderThickness="1"> | ||
<TextBlock Text="Repeating Text Forever And another line of text Just make it look different" FontSize="19" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Left"/> | ||
</Border> | ||
</VisualBrush.Visual> | ||
</VisualBrush> | ||
</Grid.Resources> | ||
<Grid.RowDefinitions> | ||
<RowDefinition /> | ||
<RowDefinition /> | ||
</Grid.RowDefinitions> | ||
|
||
<Grid Grid.Row="0"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition /> | ||
<ColumnDefinition /> | ||
<ColumnDefinition Width="0.5*"/> | ||
</Grid.ColumnDefinitions> | ||
<DockPanel Grid.Column="0" toms:AdvancedScrollWheelBehavior.Attach="WithoutAnimation"> | ||
<Label DockPanel.Dock="Top">Regular Scrolling</Label> | ||
<ScrollViewer HorizontalScrollBarVisibility="Auto"> | ||
<Grid Background="{StaticResource Background}"> | ||
<Rectangle Fill="{StaticResource RepeatingTextBrush}" Width="1500" Height="15000" /> | ||
</Grid> | ||
</ScrollViewer> | ||
</DockPanel> | ||
<DockPanel Grid.Column="1"> | ||
<Label DockPanel.Dock="Top">Smooth Scrolling</Label> | ||
<ScrollViewer HorizontalScrollBarVisibility="Auto"> | ||
<Grid Background="{StaticResource Background}"> | ||
<Rectangle Fill="{StaticResource RepeatingTextBrush}" Width="1500" Height="15000" /> | ||
</Grid> | ||
<i:Interaction.Behaviors> | ||
<toms:AdvancedScrollWheelBehavior x:Name="SmoothScrollingBehavior"> | ||
<!--<toms:AdvancedScrollWheelBehavior.EasingFunction> | ||
<QuadraticEase EasingMode="EaseOut" /> | ||
</toms:AdvancedScrollWheelBehavior.EasingFunction>--> | ||
</toms:AdvancedScrollWheelBehavior> | ||
</i:Interaction.Behaviors> | ||
</ScrollViewer> | ||
</DockPanel> | ||
<StackPanel Grid.Column="2" Orientation="Vertical"> | ||
<Label>Enabled</Label> | ||
<CheckBox IsChecked="{Binding IsEnabled, ElementName=SmoothScrollingBehavior}" /> | ||
<Label>Use Animation</Label> | ||
<CheckBox IsChecked="{Binding UseScrollingAnimation, ElementName=SmoothScrollingBehavior}" /> | ||
<Label>Animation Duration</Label> | ||
<TextBox Text="{Binding ScrollingAnimationDuration, ElementName=SmoothScrollingBehavior}" /> | ||
</StackPanel> | ||
</Grid> | ||
<Grid Grid.Row="1"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition /> | ||
<ColumnDefinition /> | ||
<ColumnDefinition Width="0.5*"/> | ||
</Grid.ColumnDefinitions> | ||
<DockPanel Grid.Column="0"> | ||
<Label DockPanel.Dock="Top">Regular Scrolling</Label> | ||
<ListBox ItemsSource="{Binding SampleData}" /> | ||
</DockPanel> | ||
<DockPanel Grid.Column="1"> | ||
<Label DockPanel.Dock="Top">Smooth Scrolling</Label> | ||
<ListBox ItemsSource="{Binding SampleData}"> | ||
<i:Interaction.Behaviors> | ||
<toms:AdvancedScrollWheelBehavior x:Name="SmoothScrollingBehavior2"/> | ||
</i:Interaction.Behaviors> | ||
</ListBox> | ||
</DockPanel> | ||
<StackPanel Grid.Column="2" Orientation="Vertical"> | ||
<Label>Enabled</Label> | ||
<CheckBox IsChecked="{Binding IsEnabled, ElementName=SmoothScrollingBehavior2}" /> | ||
<Label>Use Animation</Label> | ||
<CheckBox IsChecked="{Binding UseScrollingAnimation, ElementName=SmoothScrollingBehavior2}" /> | ||
<Label>Animation Duration</Label> | ||
<TextBox Text="{Binding ScrollingAnimationDuration, ElementName=SmoothScrollingBehavior2}" /> | ||
</StackPanel> | ||
</Grid> | ||
</Grid> | ||
</UserControl> |
This file contains 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 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 was deleted.
Oops, something went wrong.
Oops, something went wrong.