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
26 changes: 13 additions & 13 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
<PackageVersion Include="FluentFTP" Version="52.0.0" />
<PackageVersion Include="LibGit2Sharp" Version="0.30.0" />
<PackageVersion Include="MessageFormat" Version="7.1.2" />
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="9.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.1" />
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.2" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="3.0.0" />
<PackageVersion Include="Sentry" Version="5.1.0" />
<PackageVersion Include="Sentry" Version="5.1.1" />
<PackageVersion Include="SevenZipSharp" Version="1.0.2" />
<PackageVersion Include="SQLitePCLRaw.bundle_green" Version="2.1.10" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.6.250205002" />
<PackageVersion Include="Microsoft.Graphics.Win2D" Version="1.3.2" />
<PackageVersion Include="TagLibSharp" Version="2.3.0" />
<PackageVersion Include="Tulpep.ActiveDirectoryObjectPicker" Version="3.0.11" />
<PackageVersion Include="WinUIEx" Version="2.5.1" />
<PackageVersion Include="Vanara.Windows.Extensions" Version="4.0.4" />
<PackageVersion Include="Vanara.Windows.Shell" Version="4.0.4" />
<PackageVersion Include="Vanara.Windows.Extensions" Version="4.0.5" />
<PackageVersion Include="Vanara.Windows.Shell" Version="4.0.5" />
<PackageVersion Include="Microsoft.Management.Infrastructure" Version="3.0.0" />
<PackageVersion Include="Microsoft.Management.Infrastructure.Runtime.Win" Version="3.0.0" />
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
Expand All @@ -45,13 +45,13 @@
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.12.0" />
<PackageVersion Include="PolySharp" Version="1.15.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.1" />
<PackageVersion Include="System.IO.Hashing" Version="9.0.1" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.1" />
<PackageVersion Include="System.Text.Json" Version="9.0.2" />
<PackageVersion Include="System.IO.Hashing" Version="9.0.2" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.2" />
<PackageVersion Include="Appium.WebDriver" Version="4.4.5" />
<PackageVersion Include="Axe.Windows" Version="2.4.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.7.3" />
<PackageVersion Include="MSTest.TestFramework" Version="3.7.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.8.2" />
<PackageVersion Include="MSTest.TestFramework" Version="3.8.2" />
</ItemGroup>
</Project>
30 changes: 8 additions & 22 deletions src/Files.App.Controls/BladeView/BladeItem.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@ namespace Files.App.Controls
public partial class BladeItem
{
/// <summary>
/// Identifies the <see cref="TitleBarVisibility"/> dependency property.
/// </summary>
public static readonly DependencyProperty TitleBarVisibilityProperty = DependencyProperty.Register(nameof(TitleBarVisibility), typeof(Visibility), typeof(BladeItem), new PropertyMetadata(default(Visibility)));

/// <summary>
/// Identifies the <see cref="TitleBarBackground"/> dependency property.
/// Identifies the <see cref="CloseButtonBackground"/> dependency property.
/// </summary>
public static readonly DependencyProperty TitleBarBackgroundProperty = DependencyProperty.Register(nameof(TitleBarBackground), typeof(Brush), typeof(BladeItem), new PropertyMetadata(default(Brush)));
public static readonly DependencyProperty CloseButtonBackgroundProperty = DependencyProperty.Register(nameof(CloseButtonBackground), typeof(Brush), typeof(BladeItem), new PropertyMetadata(default(Brush)));

/// <summary>
/// Identifies the <see cref="CloseButtonBackground"/> dependency property.
/// Identifies the <see cref="CloseButtonVisibility"/> dependency property.
/// </summary>
public static readonly DependencyProperty CloseButtonBackgroundProperty = DependencyProperty.Register(nameof(CloseButtonBackground), typeof(Brush), typeof(BladeItem), new PropertyMetadata(default(Brush)));
public static readonly DependencyProperty CloseButtonVisibilityProperty = DependencyProperty.Register(nameof(CloseButtonVisibility), typeof(Visibility), typeof(BladeItem), new PropertyMetadata(default(Visibility)));

/// <summary>
/// Identifies the <see cref="IsOpen"/> dependency property.
Expand All @@ -53,21 +48,12 @@ public Brush CloseButtonForeground
}

/// <summary>
/// Gets or sets the visibility of the title bar for this blade
/// </summary>
public Visibility TitleBarVisibility
{
get { return (Visibility)GetValue(TitleBarVisibilityProperty); }
set { SetValue(TitleBarVisibilityProperty, value); }
}

/// <summary>
/// Gets or sets the background color of the title bar
/// Gets or sets the visibility of the close button
/// </summary>
public Brush TitleBarBackground
public Visibility CloseButtonVisibility
{
get { return (Brush)GetValue(TitleBarBackgroundProperty); }
set { SetValue(TitleBarBackgroundProperty, value); }
get { return (Visibility)GetValue(CloseButtonVisibilityProperty); }
set { SetValue(CloseButtonVisibilityProperty, value); }
}

/// <summary>
Expand Down
65 changes: 2 additions & 63 deletions src/Files.App.Controls/BladeView/BladeItem.cs
Original file line number Diff line number Diff line change
@@ -1,45 +1,33 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml.Automation.Peers;
using Microsoft.UI.Xaml.Automation;

namespace Files.App.Controls
{
/// <summary>
/// The Blade is used as a child in the BladeView
/// </summary>
[TemplatePart(Name = "CloseButton", Type = typeof(Button))]
[TemplatePart(Name = "EnlargeButton", Type = typeof(Button))]
public partial class BladeItem : Expander
public partial class BladeItem : ContentControl
{
private Button _closeButton;
private Button _enlargeButton;
private double _normalModeWidth;
private bool _loaded = false;

/// <summary>
/// Initializes a new instance of the <see cref="BladeItem"/> class.
/// </summary>
public BladeItem()
{
DefaultStyleKey = typeof(BladeItem);

SizeChanged += OnSizeChanged;
Expanding += OnExpanding;
Collapsed += OnCollapsed;
}

/// <summary>
/// Override default OnApplyTemplate to capture child controls
/// </summary>
protected override void OnApplyTemplate()
{
_loaded = true;
base.OnApplyTemplate();

_closeButton = GetTemplateChild("CloseButton") as Button;
_enlargeButton = GetTemplateChild("EnlargeButton") as Button;

if (_closeButton == null)
{
Expand All @@ -48,43 +36,7 @@ protected override void OnApplyTemplate()

_closeButton.Click -= CloseButton_Click;
_closeButton.Click += CloseButton_Click;

if (_enlargeButton == null)
{
return;
}

_enlargeButton.Click -= EnlargeButton_Click;
_enlargeButton.Click += EnlargeButton_Click;
}

/// <inheritdoc/>
private void OnExpanding(Expander sender, ExpanderExpandingEventArgs args)
{
if (_loaded)
{
Width = _normalModeWidth;
VisualStateManager.GoToState(this, "Expanded", true);
if (_enlargeButton != null)
{
AutomationProperties.SetName(_enlargeButton, "Expand Blade Item");
}
}
}

/// <inheritdoc/>
private void OnCollapsed(Expander sender, ExpanderCollapsedEventArgs args)
{
if (_loaded)
{
Width = double.NaN;
if (_enlargeButton != null)
{
AutomationProperties.SetName(_enlargeButton, "Collapse Blade Item");
}
}
}

/// <summary>
/// Creates AutomationPeer (<see cref="UIElement.OnCreateAutomationPeer"/>)
/// </summary>
Expand All @@ -94,22 +46,9 @@ protected override AutomationPeer OnCreateAutomationPeer()
return new BladeItemAutomationPeer(this);
}

private void OnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs)
{
if (IsExpanded)
{
_normalModeWidth = Width;
}
}

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
IsOpen = false;
}

private void EnlargeButton_Click(object sender, RoutedEventArgs e)
{
IsExpanded = !IsExpanded;
}
}
}
6 changes: 0 additions & 6 deletions src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ protected override string GetNameCore()
return name;
}

name = this.OwnerBladeItem.Header?.ToString();
if (!string.IsNullOrEmpty(name))
{
return name;
}

TextBlock textBlock = this.OwnerBladeItem.FindDescendant<TextBlock>();
if (textBlock != null)
{
Expand Down
23 changes: 0 additions & 23 deletions src/Files.App.Controls/BladeView/BladeView.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ public partial class BladeView
/// </summary>
public static readonly DependencyProperty BladeModeProperty = DependencyProperty.RegisterAttached(nameof(BladeMode), typeof(BladeMode), typeof(BladeView), new PropertyMetadata(BladeMode.Normal, OnBladeModeChanged));

/// <summary>
/// Identifies the <see cref="AutoCollapseCountThreshold"/> attached property.
/// </summary>
public static readonly DependencyProperty AutoCollapseCountThresholdProperty = DependencyProperty.RegisterAttached(nameof(AutoCollapseCountThreshold), typeof(int), typeof(BladeView), new PropertyMetadata(int.MaxValue, OnOpenBladesChanged));

/// <summary>
/// Gets or sets a collection of visible blades
/// </summary>
Expand All @@ -49,24 +44,6 @@ public BladeMode BladeMode
set { SetValue(BladeModeProperty, value); }
}

/// <summary>
/// Gets or sets a value indicating what the overflow amount should be to start auto collapsing blade items
/// </summary>
/// <example>
/// For example we put AutoCollapseCountThreshold = 2
/// This means that each time a blade is added to the bladeview collection,
/// we will validate the amount of added blades that have a title bar visible.
/// If this number get's bigger than AutoCollapseCountThreshold, we will collapse all blades but the last one
/// </example>
/// <remarks>
/// We don't touch blade items that have no title bar
/// </remarks>
public int AutoCollapseCountThreshold
{
get { return (int)GetValue(AutoCollapseCountThresholdProperty); }
set { SetValue(AutoCollapseCountThresholdProperty, value); }
}

private static void OnBladeModeChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
var bladeView = (BladeView)dependencyObject;
Expand Down
19 changes: 0 additions & 19 deletions src/Files.App.Controls/BladeView/BladeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,6 @@ private void CycleBlades()
}
}
}

// For now we skip this feature when blade mode is set to fullscreen
if (AutoCollapseCountThreshold > 0 && BladeMode != BladeMode.Fullscreen && ActiveBlades.Any())
{
var openBlades = ActiveBlades.Where(item => item.TitleBarVisibility == Visibility.Visible).ToList();
if (openBlades.Count > AutoCollapseCountThreshold)
{
for (int i = 0; i < openBlades.Count - 1; i++)
{
openBlades[i].IsExpanded = false;
}
}
}
}

private BladeItem GetBladeItem(object item)
Expand Down Expand Up @@ -161,12 +148,6 @@ await DispatcherQueue.EnqueueAsync(

BladeClosed?.Invoke(this, blade);
ActiveBlades.Remove(blade);

var lastBlade = ActiveBlades.LastOrDefault();
if (lastBlade != null && lastBlade.TitleBarVisibility == Visibility.Visible)
{
lastBlade.IsExpanded = true;
}
}

private ScrollViewer GetScrollViewer()
Expand Down
Loading
Loading