Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Files/BaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ public abstract class BaseLayout : Page, IBaseLayout, INotifyPropertyChanged

public bool IsRenamingItem { get; set; } = false;

private bool isMiddleClickToScrollEnabled = true;
public bool IsMiddleClickToScrollEnabled
{
get => isMiddleClickToScrollEnabled;
set
{
if (isMiddleClickToScrollEnabled != value)
{
isMiddleClickToScrollEnabled = value;
NotifyPropertyChanged(nameof(IsMiddleClickToScrollEnabled));
}
}
}

private CollectionViewSource collectionViewSource = new CollectionViewSource()
{
IsSourceGrouped = true,
Expand Down
2 changes: 2 additions & 0 deletions Files/Files.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<DisableXbfLineInfo>False</DisableXbfLineInfo>
<AppxBundlePlatforms>x86|x64|arm|arm64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<Win32Resource>Resources\MiddleClickScrolling-CursorType.res</Win32Resource>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -610,6 +611,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\AnimatedVisuals\LottiePulseStatusCenter.json" />
<Content Include="Resources\MiddleClickScrolling-CursorType.res" />
<None Include="Assets\terminal\terminal.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
2 changes: 2 additions & 0 deletions Files/IBaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public interface IBaseLayout : IDisposable

bool IsItemSelected { get; }

bool IsMiddleClickToScrollEnabled { get; set; }

public List<ListedItem> SelectedItems { get; }

public ListedItem SelectedItem { get; }
Expand Down
4 changes: 4 additions & 0 deletions Files/Interacts/BaseLayoutCommandImplementationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ public virtual async void ItemPointerPressed(PointerRoutedEventArgs e)
{
if ((e.OriginalSource as FrameworkElement)?.DataContext is ListedItem Item && Item.PrimaryItemAttribute == StorageItemTypes.Folder)
{
// If a folder item was clicked, disable middle mouse click to scroll to cancel the mouse scrolling state and re-enable it
SlimContentPage.IsMiddleClickToScrollEnabled = false;
SlimContentPage.IsMiddleClickToScrollEnabled = true;

if (Item.IsShortcutItem)
{
await NavigationHelpers.OpenPathInNewTab(((e.OriginalSource as FrameworkElement)?.DataContext as ShortcutItem)?.TargetPath ?? Item.ItemPath);
Expand Down
Binary file not shown.
8 changes: 5 additions & 3 deletions Files/Views/LayoutModes/ColumnViewBase.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
xmlns:local3="using:Files.Filesystem.Cloud"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:tui="using:Microsoft.Toolkit.Uwp.UI"
x:Name="PageRoot"
mc:Ignorable="d">
<local:BaseLayout.Resources>
Expand Down Expand Up @@ -1270,6 +1271,7 @@
<SemanticZoom.ZoomedInView>
<ListView
x:Name="FileList"
tui:ScrollViewerExtensions.EnableMiddleClickScrolling="{x:Bind IsMiddleClickToScrollEnabled, Mode=OneWay}"
x:FieldModifier="public"
AllowDrop="{x:Bind InstanceViewModel.IsPageTypeSearchResults, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
CanDragItems="{x:Bind InstanceViewModel.IsPageTypeSearchResults, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
Expand Down Expand Up @@ -1342,15 +1344,15 @@
Source="{x:Bind FileImage, Mode=OneWay}"
Stretch="Uniform"
Visibility="{x:Bind LoadFileIcon, Mode=OneWay}" />
<FontIcon
<FontIcon
x:Name="FolderGlyphIcon"
Width="24"
Height="24"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
x:Load="{x:Bind LoadFolderGlyph, Mode=OneWay}"
Glyph="&#xF12B;" />
<Viewbox
Glyph="&#xF12B;" />
<Viewbox
x:Name="TypeUnknownGlyph"
MaxWidth="24"
MaxHeight="24"
Expand Down
8 changes: 5 additions & 3 deletions Files/Views/LayoutModes/ColumnViewBrowser.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
xmlns:local3="using:Files.Filesystem.Cloud"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:tui="using:Microsoft.Toolkit.Uwp.UI"
x:Name="PageRoot"
mc:Ignorable="d">
<local:BaseLayout.Resources>
Expand Down Expand Up @@ -1274,6 +1275,7 @@
<SemanticZoom.ZoomedInView>
<ListView
x:Name="FileList"
tui:ScrollViewerExtensions.EnableMiddleClickScrolling="{x:Bind IsMiddleClickToScrollEnabled, Mode=OneWay}"
x:FieldModifier="public"
AllowDrop="{x:Bind InstanceViewModel.IsPageTypeSearchResults, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
CanDragItems="{x:Bind InstanceViewModel.IsPageTypeSearchResults, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
Expand Down Expand Up @@ -1347,15 +1349,15 @@
Source="{x:Bind FileImage, Mode=OneWay}"
Stretch="Uniform"
Visibility="{x:Bind LoadFileIcon, Mode=OneWay}" />
<FontIcon
<FontIcon
x:Name="FolderGlyphIcon"
Width="24"
Height="24"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
x:Load="{x:Bind LoadFolderGlyph, Mode=OneWay}"
Glyph="&#xF12B;" />
<Viewbox
Glyph="&#xF12B;" />
<Viewbox
x:Name="TypeUnknownGlyph"
MaxWidth="24"
MaxHeight="24"
Expand Down
2 changes: 2 additions & 0 deletions Files/Views/LayoutModes/DetailsLayoutBrowser.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
xmlns:local2="using:Files.Filesystem"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:tui="using:Microsoft.Toolkit.Uwp.UI"
xmlns:uc="using:Files.UserControls"
x:Name="PageRoot"
NavigationCacheMode="Enabled"
Expand Down Expand Up @@ -201,6 +202,7 @@
Padding="8,0,8,8"
HorizontalAlignment="Stretch"
VerticalContentAlignment="Stretch"
tui:ScrollViewerExtensions.EnableMiddleClickScrolling="{x:Bind IsMiddleClickToScrollEnabled, Mode=OneWay}"
x:FieldModifier="public"
AllowDrop="{x:Bind InstanceViewModel.IsPageTypeSearchResults, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
CanDragItems="{x:Bind InstanceViewModel.IsPageTypeSearchResults, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
Expand Down
2 changes: 2 additions & 0 deletions Files/Views/LayoutModes/GridViewBrowser.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
xmlns:local3="using:Files.Filesystem.Cloud"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:tui="using:Microsoft.Toolkit.Uwp.UI"
x:Name="PageRoot"
NavigationCacheMode="Enabled"
mc:Ignorable="d">
Expand Down Expand Up @@ -480,6 +481,7 @@
animations:ItemsReorderAnimation.Duration="0:0:0.350"
behaviors:StretchedGridViewItems.FillBeforeWrap="True"
behaviors:StretchedGridViewItems.MinItemWidth="{x:Bind GridViewItemMinWidth, Mode=OneWay}"
tui:ScrollViewerExtensions.EnableMiddleClickScrolling="{x:Bind IsMiddleClickToScrollEnabled, Mode=OneWay}"
x:FieldModifier="public"
AllowDrop="{x:Bind InstanceViewModel.IsPageTypeSearchResults, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
CanDragItems="{x:Bind InstanceViewModel.IsPageTypeSearchResults, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
Expand Down