diff --git a/Directory.Packages.props b/Directory.Packages.props index a0ad92f459a0..a73c5be55fd6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -21,13 +21,13 @@ - - - - + + + + - + @@ -35,8 +35,8 @@ - - + + @@ -45,13 +45,13 @@ - - - + + + - - - + + + \ No newline at end of file diff --git a/src/Files.App.Controls/BladeView/BladeItem.Properties.cs b/src/Files.App.Controls/BladeView/BladeItem.Properties.cs index 33435ea35dd3..5678d63a1c2a 100644 --- a/src/Files.App.Controls/BladeView/BladeItem.Properties.cs +++ b/src/Files.App.Controls/BladeView/BladeItem.Properties.cs @@ -17,19 +17,14 @@ namespace Files.App.Controls public partial class BladeItem { /// - /// Identifies the dependency property. - /// - public static readonly DependencyProperty TitleBarVisibilityProperty = DependencyProperty.Register(nameof(TitleBarVisibility), typeof(Visibility), typeof(BladeItem), new PropertyMetadata(default(Visibility))); - - /// - /// Identifies the dependency property. + /// Identifies the dependency property. /// - 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))); /// - /// Identifies the dependency property. + /// Identifies the dependency property. /// - 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))); /// /// Identifies the dependency property. @@ -53,21 +48,12 @@ public Brush CloseButtonForeground } /// - /// Gets or sets the visibility of the title bar for this blade - /// - public Visibility TitleBarVisibility - { - get { return (Visibility)GetValue(TitleBarVisibilityProperty); } - set { SetValue(TitleBarVisibilityProperty, value); } - } - - /// - /// Gets or sets the background color of the title bar + /// Gets or sets the visibility of the close button /// - public Brush TitleBarBackground + public Visibility CloseButtonVisibility { - get { return (Brush)GetValue(TitleBarBackgroundProperty); } - set { SetValue(TitleBarBackgroundProperty, value); } + get { return (Visibility)GetValue(CloseButtonVisibilityProperty); } + set { SetValue(CloseButtonVisibilityProperty, value); } } /// diff --git a/src/Files.App.Controls/BladeView/BladeItem.cs b/src/Files.App.Controls/BladeView/BladeItem.cs index 4e1a83d55d02..0ba8f525f6c0 100644 --- a/src/Files.App.Controls/BladeView/BladeItem.cs +++ b/src/Files.App.Controls/BladeView/BladeItem.cs @@ -1,9 +1,7 @@ // 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 { @@ -11,24 +9,15 @@ namespace Files.App.Controls /// The Blade is used as a child in the BladeView /// [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; - /// /// Initializes a new instance of the class. /// public BladeItem() { DefaultStyleKey = typeof(BladeItem); - - SizeChanged += OnSizeChanged; - Expanding += OnExpanding; - Collapsed += OnCollapsed; } /// @@ -36,10 +25,9 @@ public BladeItem() /// protected override void OnApplyTemplate() { - _loaded = true; + base.OnApplyTemplate(); _closeButton = GetTemplateChild("CloseButton") as Button; - _enlargeButton = GetTemplateChild("EnlargeButton") as Button; if (_closeButton == null) { @@ -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; - } - - /// - 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"); - } - } - } - - /// - private void OnCollapsed(Expander sender, ExpanderCollapsedEventArgs args) - { - if (_loaded) - { - Width = double.NaN; - if (_enlargeButton != null) - { - AutomationProperties.SetName(_enlargeButton, "Collapse Blade Item"); - } - } } - /// /// Creates AutomationPeer () /// @@ -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; - } } } diff --git a/src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs b/src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs index 8b03ea9ab09b..0666e56460ae 100644 --- a/src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs +++ b/src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs @@ -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(); if (textBlock != null) { diff --git a/src/Files.App.Controls/BladeView/BladeView.Properties.cs b/src/Files.App.Controls/BladeView/BladeView.Properties.cs index b651c039504d..c953163127e3 100644 --- a/src/Files.App.Controls/BladeView/BladeView.Properties.cs +++ b/src/Files.App.Controls/BladeView/BladeView.Properties.cs @@ -26,11 +26,6 @@ public partial class BladeView /// public static readonly DependencyProperty BladeModeProperty = DependencyProperty.RegisterAttached(nameof(BladeMode), typeof(BladeMode), typeof(BladeView), new PropertyMetadata(BladeMode.Normal, OnBladeModeChanged)); - /// - /// Identifies the attached property. - /// - public static readonly DependencyProperty AutoCollapseCountThresholdProperty = DependencyProperty.RegisterAttached(nameof(AutoCollapseCountThreshold), typeof(int), typeof(BladeView), new PropertyMetadata(int.MaxValue, OnOpenBladesChanged)); - /// /// Gets or sets a collection of visible blades /// @@ -49,24 +44,6 @@ public BladeMode BladeMode set { SetValue(BladeModeProperty, value); } } - /// - /// Gets or sets a value indicating what the overflow amount should be to start auto collapsing blade items - /// - /// - /// 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 - /// - /// - /// We don't touch blade items that have no title bar - /// - public int AutoCollapseCountThreshold - { - get { return (int)GetValue(AutoCollapseCountThresholdProperty); } - set { SetValue(AutoCollapseCountThresholdProperty, value); } - } - private static void OnBladeModeChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { var bladeView = (BladeView)dependencyObject; diff --git a/src/Files.App.Controls/BladeView/BladeView.cs b/src/Files.App.Controls/BladeView/BladeView.cs index 2a1ecbb3b250..48456f58261f 100644 --- a/src/Files.App.Controls/BladeView/BladeView.cs +++ b/src/Files.App.Controls/BladeView/BladeView.cs @@ -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) @@ -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() diff --git a/src/Files.App.Controls/BladeView/BladeView.xaml b/src/Files.App.Controls/BladeView/BladeView.xaml index 7d9f24796b52..28e15f3b4451 100644 --- a/src/Files.App.Controls/BladeView/BladeView.xaml +++ b/src/Files.App.Controls/BladeView/BladeView.xaml @@ -88,7 +88,6 @@ - @@ -102,18 +101,7 @@ - - - - - - - - @@ -121,70 +109,24 @@ Width="{TemplateBinding Width}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> - - - - - - - - - - - - - -