Skip to content

Portable Tool for an Ideal Windows Setup

add scroll fade behavior for scrollviewers deb v5.4.9

Greedekscab4b35492d3
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index ec0742f9..a7e192be 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -170,6 +170,7 @@
<Compile Include="Core\ViewModel\SystemViewModel.cs" />
<Compile Include="Core\ViewModel\ToolsetViewModel.cs" />
<Compile Include="Utilities\Animation\BlurAnimation.cs" />
+ <Compile Include="Utilities\Behaviors\ScrollFadeBehavior.cs" />
<Compile Include="Utilities\Configuration\IconExtractProvider.cs" />
<Compile Include="Utilities\Configuration\NetworkProvider.cs" />
<Compile Include="Utilities\Configuration\StorageTypeIdentifier.cs" />
diff --git a/.Source/GTweak/Properties/AssemblyInfo.cs b/.Source/GTweak/Properties/AssemblyInfo.cs
index 06072810..ef13ff66 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.cs
+++ b/.Source/GTweak/Properties/AssemblyInfo.cs
@@ -7,9 +7,9 @@ using System.Windows;
[assembly: AssemblyProduct("GTweak")]
[assembly: AssemblyCopyright("� 2024-2026 Greedeks")]
[assembly: AssemblyTrademark("Greedeks")]
-[assembly: AssemblyInformationalVersion("Build: 5.4.8")]
-[assembly: AssemblyVersion("5.4.34.666")]
-[assembly: AssemblyFileVersion("5.4.34.666")]
+[assembly: AssemblyInformationalVersion("Build: 5.4.9")]
+[assembly: AssemblyVersion("5.4.23.729")]
+[assembly: AssemblyFileVersion("5.4.23.729")]
[assembly: ComVisible(false)]
diff --git a/.Source/GTweak/Properties/AssemblyInfo.tt b/.Source/GTweak/Properties/AssemblyInfo.tt
index 259aef6e..1a4db278 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.tt
+++ b/.Source/GTweak/Properties/AssemblyInfo.tt
@@ -22,7 +22,7 @@ using System.Windows;
[assembly: AssemblyMetadata("RepositoryType", "git")]
<#+
- private const string majorVersion = "Build: 5.4.8";
+ private const string majorVersion = "Build: 5.4.9";
private string GenerateVersion()
{
diff --git a/.Source/GTweak/Utilities/Behaviors/ScrollFadeBehavior.cs b/.Source/GTweak/Utilities/Behaviors/ScrollFadeBehavior.cs
new file mode 100644
index 00000000..5b3e692d
--- /dev/null
+++ b/.Source/GTweak/Utilities/Behaviors/ScrollFadeBehavior.cs
@@ -0,0 +1,143 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace GTweak.Utilities.Behaviors
+{
+ internal static class ScrollFadeBehavior
+ {
+ public static readonly DependencyProperty EnableFadeProperty = DependencyProperty.RegisterAttached("EnableFade", typeof(bool), typeof(ScrollFadeBehavior), new PropertyMetadata(false, OnEnableFadeChanged));
+
+ public static bool GetEnableFade(DependencyObject obj) => (bool)obj.GetValue(EnableFadeProperty);
+ public static void SetEnableFade(DependencyObject obj, bool value) => obj.SetValue(EnableFadeProperty, value);
+
+ private static void OnEnableFadeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is ScrollViewer scrollViewer)
+ {
+ if ((bool)e.NewValue)
+ {
+ scrollViewer.Loaded += ScrollViewer_Loaded;
+ scrollViewer.Unloaded += ScrollViewer_Unloaded;
+
+ if (scrollViewer.IsLoaded)
+ {
+ AttachScrollEvents(scrollViewer);
+ InitializeOpacityMask(scrollViewer);
+ UpdateMask(scrollViewer);
+ }
+ }
+ else
+ {
+ scrollViewer.Loaded -= ScrollViewer_Loaded;
+ scrollViewer.Unloaded -= ScrollViewer_Unloaded;
+ DetachScrollEvents(scrollViewer);
+ scrollViewer.OpacityMask = null;
+ }
+ }
+ }
+
+ private static void ScrollViewer_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (sender is ScrollViewer scrollViewer)
+ {
+ AttachScrollEvents(scrollViewer);
+ InitializeOpacityMask(scrollViewer);
+
+ scrollViewer.Dispatcher.BeginInvoke(new Action(() => UpdateMask(scrollViewer)), System.Windows.Threading.DispatcherPriority.Render);
+ }
+ }
+
+ private static void ScrollViewer_Unloaded(object sender, RoutedEventArgs e)
+ {
+ if (sender is ScrollViewer scrollViewer)
+ {
+ DetachScrollEvents(scrollViewer);
+ scrollViewer.OpacityMask = null;
+ }
+ }
+
+ private static void AttachScrollEvents(ScrollViewer scrollViewer)
+ {
+ scrollViewer.ScrollChanged -= ScrollViewer_ScrollChanged;
+ scrollViewer.SizeChanged -= ScrollViewer_SizeChanged;
+
+ scrollViewer.ScrollChanged += ScrollViewer_ScrollChanged;
+ scrollViewer.SizeChanged += ScrollViewer_SizeChanged;
+ }
+
+ private static void DetachScrollEvents(ScrollViewer scrollViewer)
+ {
+ scrollViewer.ScrollChanged -= ScrollViewer_ScrollChanged;
+ scrollViewer.SizeChanged -= ScrollViewer_SizeChanged;
+ }
+
+ private static void ScrollViewer_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ if (sender is ScrollViewer scrollViewer)
+ {
+ UpdateMask(scrollViewer);
+ }
+ }
+
+ private static void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
+ {
+ if (e.VerticalChange != 0 || e.ViewportHeightChange != 0 || e.ExtentHeightChange != 0)
+ {
+ if (sender is ScrollViewer scrollViewer)
+ {
+ UpdateMask(scrollViewer);
+ }
+ }
+ }
+
+ private static void InitializeOpacityMask(ScrollViewer scrollViewer)
+ {
+ if (scrollViewer.OpacityMask is LinearGradientBrush)
+ {
+ return;
+ }
+
+ LinearGradientBrush brush = new LinearGradientBrush
+ {
+ StartPoint = new Point(0, 0),
+ EndPoint = new Point(0, 1)
+ };
+
+ brush.GradientStops.Add(new GradientStop(Colors.Transparent, 0.0));
+ brush.GradientStops.Add(new GradientStop(Colors.Black, 0.05));
+ brush.GradientStops.Add(new GradientStop(Colors.Black, 0.95));
+ brush.GradientStops.Add(new GradientStop(Colors.Transparent, 1.0));
+
+ scrollViewer.OpacityMask = brush;
+ }
+
+ private static void UpdateMask(ScrollViewer scrollViewer)
+ {
+ if (scrollViewer.OpacityMask is LinearGradientBrush brush && brush.GradientStops.Count == 4)
+ {
+ if (scrollViewer.ScrollableHeight == 0)
+ {
+ UpdateGradientStopIfNotEqual(brush.GradientStops[0], Colors.Black);
+ UpdateGradientStopIfNotEqual(brush.GradientStops[3], Colors.Black);
+ return;
+ }
+
+ Color targetTopColor = scrollViewer.VerticalOffset <= 0 ? Colors.Black : Colors.Transparent;
+ Color targetBottomColor = scrollViewer.VerticalOffset >= (scrollViewer.ScrollableHeight - 1.0) ? Colors.Black : Colors.Transparent;
+
+ UpdateGradientStopIfNotEqual(brush.GradientStops[0], targetTopColor);
+ UpdateGradientStopIfNotEqual(brush.GradientStops[3], targetBottomColor);
+ }
+ }
+
+ private static void UpdateGradientStopIfNotEqual(GradientStop stop, Color targetColor)
+ {
+ if (stop.Color != targetColor)
+ {
+ stop.Color = targetColor;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/.Source/GTweak/View/AddonsView.xaml b/.Source/GTweak/View/AddonsView.xaml
index 55cd5296..2301946f 100644
--- a/.Source/GTweak/View/AddonsView.xaml
+++ b/.Source/GTweak/View/AddonsView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -41,7 +42,7 @@
<Border Grid.Row="1" Background="{StaticResource Brush_Separator}" Height="1.2" Margin="10,10,10,0" CornerRadius="10" HorizontalAlignment="Stretch"/>
<Grid Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid>
<ItemsControl ItemsSource="{Binding Addons}" VirtualizingPanel.IsVirtualizing="True">
<ItemsControl.ItemsPanel>
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml b/.Source/GTweak/View/ConfidentialityView.xaml
index 1d08d41f..7dc9ca46 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml
+++ b/.Source/GTweak/View/ConfidentialityView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
@@ -26,7 +27,7 @@
</Grid.RowDefinitions>
<Grid Grid.Row="0">
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<uc:FlowPanel VerticalSpacing="20" HorizontalSpacing="5" Margin="10">
<uc:ToggleButton x:Name="TglButton1" Style="{StaticResource ToggleStyle}" State="{Binding [TglButton1].State}" TextResource="{DynamicResource tgl1_conf}" Description="{DynamicResource tgl1_desc_conf}" />
diff --git a/.Source/GTweak/View/DataSystemView.xaml b/.Source/GTweak/View/DataSystemView.xaml
index 932661e6..50765dc3 100644
--- a/.Source/GTweak/View/DataSystemView.xaml
+++ b/.Source/GTweak/View/DataSystemView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -145,7 +146,7 @@
</Grid>
<Grid Grid.Row="1">
- <ScrollViewer Margin="0,0,0,10" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" Margin="0,0,0,10" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
diff --git a/.Source/GTweak/View/InterfaceView.xaml b/.Source/GTweak/View/InterfaceView.xaml
index 4d7983c9..38370b3e 100644
--- a/.Source/GTweak/View/InterfaceView.xaml
+++ b/.Source/GTweak/View/InterfaceView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
@@ -26,7 +27,7 @@
</Grid.RowDefinitions>
<Grid Grid.Row="0">
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<uc:FlowPanel VerticalSpacing="20" HorizontalSpacing="5" Margin="10">
<StackPanel Orientation="Vertical" Margin="0,-10,0,-10">
diff --git a/.Source/GTweak/View/PackagesView.xaml b/.Source/GTweak/View/PackagesView.xaml
index d7bd03e6..0c061418 100644
--- a/.Source/GTweak/View/PackagesView.xaml
+++ b/.Source/GTweak/View/PackagesView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -35,7 +36,7 @@
</Grid>
<Grid Grid.Row="1">
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<uc:FlowPanel UseMasonryLayout="False" HorizontalSpacing="30" Margin="10,10,10,10" HorizontalAlignment="Center" VerticalAlignment="Top">
<ToggleButton x:Name="MicrosoftStore" IsChecked="{Binding [MicrosoftStore].Installed}" IsEnabled="{Binding [MicrosoftStore].IsUnavailable}" ToolTip="{DynamicResource MicrosoftStore_pkg}" Style="{StaticResource TglPackages}" Tag="{StaticResource Img_MicrosoftStore}"/>
diff --git a/.Source/GTweak/View/ServicesView.xaml b/.Source/GTweak/View/ServicesView.xaml
index cf724353..5862ee98 100644
--- a/.Source/GTweak/View/ServicesView.xaml
+++ b/.Source/GTweak/View/ServicesView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
@@ -25,7 +26,7 @@
</Grid.RowDefinitions>
<Grid Grid.Row="0">
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<uc:FlowPanel VerticalSpacing="20" HorizontalSpacing="5" Margin="10">
<uc:ToggleButton x:Name="TglButton1" Style="{StaticResource ToggleStyle}" State="{Binding [TglButton1].State}" TextResource="{DynamicResource tgl1_svc}" Description="{DynamicResource tgl1_desc_svc}" />
diff --git a/.Source/GTweak/View/SystemView.xaml b/.Source/GTweak/View/SystemView.xaml
index b38f3f2b..3ff933dd 100644
--- a/.Source/GTweak/View/SystemView.xaml
+++ b/.Source/GTweak/View/SystemView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
@@ -26,7 +27,7 @@
</Grid.RowDefinitions>
<Grid Grid.Row="0">
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<uc:FlowPanel VerticalSpacing="20" HorizontalSpacing="5" Margin="10">
<StackPanel Orientation="Vertical" Margin="0,-15,0,0">
diff --git a/.Source/GTweak/View/ToolsetView.xaml b/.Source/GTweak/View/ToolsetView.xaml
index 7c79befb..8841c3fe 100644
--- a/.Source/GTweak/View/ToolsetView.xaml
+++ b/.Source/GTweak/View/ToolsetView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -53,7 +54,7 @@
<Border Grid.Row="1" Background="{StaticResource Brush_Separator}" Height="1.2" Margin="10,10,10,0" CornerRadius="10" HorizontalAlignment="Stretch"/>
<Grid Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid>
<ItemsControl ItemsSource="{Binding ToolsView}">
<ItemsControl.ItemsPanel>
diff --git a/.Source/GTweak/View/UtilsView.xaml b/.Source/GTweak/View/UtilsView.xaml
index 12e3c03f..e721e7b2 100644
--- a/.Source/GTweak/View/UtilsView.xaml
+++ b/.Source/GTweak/View/UtilsView.xaml
@@ -3,6 +3,7 @@
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"
+ xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:uc="clr-namespace:GTweak.Assets.UserControls"
xmlns:local="clr-namespace:GTweak.View"
mc:Ignorable="d" d:Width="1014" Style="{StaticResource LaunchPage}">
@@ -21,7 +22,7 @@
</Grid>
<Grid Grid.Row="1">
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <ScrollViewer b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<uc:FlowPanel Margin="20,20,5,20" UseMasonryLayout="False" HorizontalSpacing="5" VerticalSpacing="10" ContentAlignment="Stretch" HorizontalAlignment="Left" VerticalAlignment="Top">
<uc:Card Title="{DynamicResource title_licens_more}" Description="{DynamicResource text_licens_more}" BtnContent="{DynamicResource btn_activation}" ClickButton="BtnLicenseWindows_ClickButton">
<uc:Card.IconStyle>