From 57a01bc7fbc45b4c29a08b6fffae22614059c0ea Mon Sep 17 00:00:00 2001 From: Martin Anderson Date: Mon, 17 Aug 2026 17:03:36 +0100 Subject: [PATCH 01/36] Initial work on modernised Propertied Dialog design Created a new branch and put an initial bit of xaml together as a starting point --- .../Dialogs/Properties/PropertiesDialog.xaml | 97 +++++++++++++++++++ .../Properties/PropertiesDialog.xaml.cs | 54 +++++++++++ .../Views/PropertiesGeneralPage.xaml | 16 +++ .../Views/PropertiesGeneralPage.xaml.cs | 31 ++++++ .../Files.App.UITests.csproj | 20 ++++ tests/Files.App.UITests/MainWindow.xaml | 1 + tests/Files.App.UITests/MainWindow.xaml.cs | 1 + .../Views/DialogWindowsPage.xaml | 19 ++++ .../Views/DialogWindowsPage.xaml.cs | 47 +++++++++ 9 files changed, 286 insertions(+) create mode 100644 tests/Files.App.UITests/Dialogs/Properties/PropertiesDialog.xaml create mode 100644 tests/Files.App.UITests/Dialogs/Properties/PropertiesDialog.xaml.cs create mode 100644 tests/Files.App.UITests/Dialogs/Properties/Views/PropertiesGeneralPage.xaml create mode 100644 tests/Files.App.UITests/Dialogs/Properties/Views/PropertiesGeneralPage.xaml.cs create mode 100644 tests/Files.App.UITests/Views/DialogWindowsPage.xaml create mode 100644 tests/Files.App.UITests/Views/DialogWindowsPage.xaml.cs diff --git a/tests/Files.App.UITests/Dialogs/Properties/PropertiesDialog.xaml b/tests/Files.App.UITests/Dialogs/Properties/PropertiesDialog.xaml new file mode 100644 index 000000000000..7aedfb2a82ff --- /dev/null +++ b/tests/Files.App.UITests/Dialogs/Properties/PropertiesDialog.xaml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/tests/Files.App.UITests/Dialogs/PropertiesGeneralPage.xaml.cs b/tests/Files.App.UITests/Dialogs/PropertiesGeneralPage.xaml.cs index a1cb5b1d296b..56c657f36c34 100644 --- a/tests/Files.App.UITests/Dialogs/PropertiesGeneralPage.xaml.cs +++ b/tests/Files.App.UITests/Dialogs/PropertiesGeneralPage.xaml.cs @@ -11,5 +11,10 @@ public PropertiesGeneralPage() { InitializeComponent(); } + + private void ClickableCard_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) + { + ClickResultText.Text = "Clicked"; + } } } From fb9be4b6ca5f4c05c42674aeda55f34d5f26256a Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Sat, 22 Aug 2026 07:00:38 +0900 Subject: [PATCH 29/36] Restore properties view separators --- .../PropertiesView/PropertiesView.xaml | 45 ++++++++++++++++ .../PropertiesViewCard.Properties.cs | 3 -- .../PropertiesView/PropertiesViewCard.cs | 17 +----- .../PropertiesView/PropertiesViewCard.xaml | 36 +++++-------- .../PropertiesViewItemSeparator.cs | 54 +++++++++++++++++++ .../Dialogs/PropertiesGeneralPage.xaml | 15 ++++-- 6 files changed, 124 insertions(+), 46 deletions(-) create mode 100644 src/Files.App.Controls/PropertiesView/PropertiesViewItemSeparator.cs diff --git a/src/Files.App.Controls/PropertiesView/PropertiesView.xaml b/src/Files.App.Controls/PropertiesView/PropertiesView.xaml index a317287c14cd..0fb29c3bbd80 100644 --- a/src/Files.App.Controls/PropertiesView/PropertiesView.xaml +++ b/src/Files.App.Controls/PropertiesView/PropertiesView.xaml @@ -6,6 +6,51 @@ + - + - + @@ -47,7 +48,7 @@ Grid.Column="1" VerticalAlignment="Center" Spacing="8"> - + @@ -67,7 +68,7 @@ - + @@ -94,13 +95,11 @@ Click="ClickableCard_Click" Header="Clickable card" IsClickEnabled="True"> - + - + @@ -130,18 +129,14 @@ - + - + @@ -180,7 +175,10 @@ - + From 69cba615cc630d146ed8faf6ba61aa414902d783 Mon Sep 17 00:00:00 2001 From: Martin Anderson Date: Sat, 22 Aug 2026 21:14:23 +0100 Subject: [PATCH 31/36] Breakpoint visual states are now working, so next I can actually apply the styling Lots of trial and error work, pushing so the working state will be preserved to git history --- .../PropertiesViewCard.Properties.cs | 15 +- .../PropertiesView/PropertiesViewCard.cs | 57 ++-- .../PropertiesView/PropertiesViewCard.xaml | 292 +++++++----------- .../Dialogs/PropertiesDetailsPage.xaml | 2 +- .../Dialogs/PropertiesGeneralPage.xaml | 50 ++- 5 files changed, 198 insertions(+), 218 deletions(-) diff --git a/src/Files.App.Controls/PropertiesView/PropertiesViewCard.Properties.cs b/src/Files.App.Controls/PropertiesView/PropertiesViewCard.Properties.cs index 3b95d8ae0507..5e4a0c9f7e1c 100644 --- a/src/Files.App.Controls/PropertiesView/PropertiesViewCard.Properties.cs +++ b/src/Files.App.Controls/PropertiesView/PropertiesViewCard.Properties.cs @@ -36,15 +36,18 @@ public GridLength LabelWidth nameof(LabelWidth), typeof(GridLength), typeof(PropertiesViewCard), - new PropertyMetadata(new GridLength(160))); + new PropertyMetadata(new GridLength(80))); - [GeneratedDependencyProperty(DefaultValue = PropertiesViewCardContentAlignment.Right)] - public partial PropertiesViewCardContentAlignment ContentAlignment { get; set; } + //[GeneratedDependencyProperty(DefaultValue = PropertiesViewCardContentAlignment.Horizontal)] + //public partial PropertiesViewCardContentAlignment ContentAlignment { get; set; } + + + [GeneratedDependencyProperty(DefaultValue = Orientation.Horizontal)] + public partial Orientation Orientation { get; set; } } public enum PropertiesViewCardContentAlignment { - Right, - Left, - Vertical, + Horizontal, + Vertical } diff --git a/src/Files.App.Controls/PropertiesView/PropertiesViewCard.cs b/src/Files.App.Controls/PropertiesView/PropertiesViewCard.cs index 9e325678fe2a..dc32eacd2018 100644 --- a/src/Files.App.Controls/PropertiesView/PropertiesViewCard.cs +++ b/src/Files.App.Controls/PropertiesView/PropertiesViewCard.cs @@ -18,9 +18,11 @@ namespace Files.App.Controls; [TemplateVisualState(Name = DisabledStateName, GroupName = CommonStatesName)] [TemplateVisualState(Name = RightStateName, GroupName = ContentAlignmentStatesName)] -[TemplateVisualState(Name = RightWrappedStateName, GroupName = ContentAlignmentStatesName)] +[TemplateVisualState(Name = WrappedStateName, GroupName = ContentAlignmentStatesName)] [TemplateVisualState(Name = LeftStateName, GroupName = ContentAlignmentStatesName)] -[TemplateVisualState(Name = VerticalStateName, GroupName = ContentAlignmentStatesName)] + +[TemplateVisualState( Name = HorizontalStateName , GroupName = OrientationStatesName )] +[TemplateVisualState(Name = VerticalStateName, GroupName = OrientationStatesName )] public partial class PropertiesViewCard : Button { private const string CommonStatesName = "CommonStates"; @@ -29,9 +31,11 @@ public partial class PropertiesViewCard : Button private const string PressedStateName = "Pressed"; private const string DisabledStateName = "Disabled"; private const string ContentAlignmentStatesName = "ContentAlignmentStates"; + private const string OrientationStatesName = "OrientationStates"; private const string RightStateName = "Right"; - private const string RightWrappedStateName = "RightWrapped"; + private const string WrappedStateName = "Wrapped"; private const string LeftStateName = "Left"; + private const string HorizontalStateName = "Horizontal"; private const string VerticalStateName = "Vertical"; private const string ContentSpacingStateName = "ContentSpacing"; private const string NoContentSpacingStateName = "NoContentSpacing"; @@ -41,7 +45,7 @@ public partial class PropertiesViewCard : Button //private const string HeaderIconPresenterHolderName = "PART_HeaderIconPresenterHolder"; private const string HeaderPresenterName = "PART_HeaderPresenter"; - private VisualStateGroup? contentAlignmentStates; + //private VisualStateGroup? contentAlignmentStates; private long? contentPropertyChangedToken; public PropertiesViewCard() @@ -55,9 +59,6 @@ protected override void OnApplyTemplate() DisableButtonInteraction(); IsEnabledChanged -= OnIsEnabledChanged; - if (contentAlignmentStates is not null) - contentAlignmentStates.CurrentStateChanged -= ContentAlignmentStates_CurrentStateChanged; - if (contentPropertyChangedToken is long token) UnregisterPropertyChangedCallback(ContentProperty, token); @@ -70,16 +71,11 @@ protected override void OnApplyTemplate() UpdateCommonState(false); //UpdateBitmapHeaderIconState(false); SetAccessibleContentName(); + UpdateOrientationState( Orientation ); contentPropertyChangedToken = RegisterPropertyChangedCallback(ContentProperty, OnContentChanged); IsEnabledChanged += OnIsEnabledChanged; - contentAlignmentStates = GetTemplateChild(ContentAlignmentStatesName) as VisualStateGroup; - if (contentAlignmentStates is not null) - { - UpdateContentSpacingState(contentAlignmentStates.CurrentState, false); - contentAlignmentStates.CurrentStateChanged += ContentAlignmentStates_CurrentStateChanged; - } } protected override AutomationPeer OnCreateAutomationPeer() @@ -158,9 +154,15 @@ partial void OnActionIconChanged(IconElement? newValue) UpdateActionIcon(); } - partial void OnContentAlignmentChanged(PropertiesViewCardContentAlignment newValue) + //partial void OnContentAlignmentChanged(PropertiesViewCardContentAlignment newValue) + //{ + // UpdateContentSpacingState(orientationStates?.CurrentState, true); + //} + + partial void OnOrientationChanged(Orientation newValue) { - UpdateContentSpacingState(contentAlignmentStates?.CurrentState, true); + //UpdateContentSpacingState( newValue , true ); + UpdateOrientationState( newValue ); } partial void OnHeaderChanged(object? newValue) @@ -231,7 +233,8 @@ private void Control_PreviewKeyUp(object sender, KeyRoutedEventArgs e) private void OnContentChanged(DependencyObject sender, DependencyProperty property) { SetAccessibleContentName(); - UpdateContentSpacingState(contentAlignmentStates?.CurrentState, false); + // + //UpdateContentSpacingState(this.Orientation, false); } private void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) @@ -277,12 +280,28 @@ private void UpdateHeader() private void ContentAlignmentStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { - UpdateContentSpacingState(e.NewState, true); + //UpdateContentSpacingState(e.NewState, true); + } + + private void UpdateOrientationState(Orientation newOrientation) + { + if ( newOrientation == Orientation.Vertical ) + { + VisualStateManager.GoToState( this , VerticalStateName , true ); + } + else + { + VisualStateManager.GoToState ( this , HorizontalStateName , true ); + } } - private void UpdateContentSpacingState(VisualState? state, bool useTransitions) + private void UpdateContentSpacingState(Orientation orientation, bool useTransitions) { - bool isVertical = state?.Name is RightWrappedStateName or VerticalStateName; + bool isVertical = false; + + if ( orientation == Orientation.Vertical ) + isVertical = true; + bool hasHeader = !IsNullOrEmptyString(Header); VisualStateManager.GoToState( this, diff --git a/src/Files.App.Controls/PropertiesView/PropertiesViewCard.xaml b/src/Files.App.Controls/PropertiesView/PropertiesViewCard.xaml index 36351bf14583..6cc873d631b5 100644 --- a/src/Files.App.Controls/PropertiesView/PropertiesViewCard.xaml +++ b/src/Files.App.Controls/PropertiesView/PropertiesViewCard.xaml @@ -34,240 +34,178 @@ 20 13 8 - 476 + + 300 + 400 + 500 + 0.4 0,0,12,0 0,0,24,0 14,0,0,0 - + + diff --git a/tests/Files.App.UITests/Dialogs/PropertiesDetailsPage.xaml b/tests/Files.App.UITests/Dialogs/PropertiesDetailsPage.xaml index 9bf427431f45..fe0978e0b09a 100644 --- a/tests/Files.App.UITests/Dialogs/PropertiesDetailsPage.xaml +++ b/tests/Files.App.UITests/Dialogs/PropertiesDetailsPage.xaml @@ -24,7 +24,7 @@ - + 148 -12,0,0,0 - @@ -48,7 +48,7 @@ Grid.Column="1" VerticalAlignment="Center" Spacing="8"> - + @@ -58,7 +58,7 @@ - + - + @@ -95,7 +98,10 @@ Click="ClickableCard_Click" Header="Clickable card" IsClickEnabled="True"> - + @@ -109,7 +115,7 @@ - + @@ -125,18 +131,36 @@ + + + + + + + + + + + + + + + - + - + @@ -146,7 +170,7 @@ - + @@ -165,16 +189,16 @@ - - + + - + - + Date: Sun, 23 Aug 2026 01:39:02 +0100 Subject: [PATCH 32/36] Making some progress on Styling - Still more to do Pushing my work so far, as I think I have made some good progress - still more to do and tidy up, and there are some issues like the control not having awareness of missing headers, and how to re-flow in those circumstances. --- .../PropertiesView/PropertiesView.xaml | 69 ++++ .../PropertiesView/PropertiesViewCard.cs | 2 +- .../PropertiesView/PropertiesViewCard.xaml | 378 ++++++++++++------ .../PropertiesView/PropertiesViewInfo.cs | 138 +++++++ .../Dialogs/PropertiesGeneralPage.xaml | 80 ++-- .../Dialogs/PropertiesGeneralPage.xaml.cs | 5 - 6 files changed, 517 insertions(+), 155 deletions(-) create mode 100644 src/Files.App.Controls/PropertiesView/PropertiesViewInfo.cs diff --git a/src/Files.App.Controls/PropertiesView/PropertiesView.xaml b/src/Files.App.Controls/PropertiesView/PropertiesView.xaml index 0fb29c3bbd80..af17478e52f8 100644 --- a/src/Files.App.Controls/PropertiesView/PropertiesView.xaml +++ b/src/Files.App.Controls/PropertiesView/PropertiesView.xaml @@ -4,6 +4,75 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Files.App.Controls"> + + + + + + + - + + 200 + + @@ -23,11 +23,12 @@ - + diff --git a/tests/Files.App.UITests/Dialogs/PropertiesGeneralPage.xaml b/tests/Files.App.UITests/Dialogs/PropertiesGeneralPage.xaml index f6e787b3d885..03bf94633e5e 100644 --- a/tests/Files.App.UITests/Dialogs/PropertiesGeneralPage.xaml +++ b/tests/Files.App.UITests/Dialogs/PropertiesGeneralPage.xaml @@ -11,8 +11,7 @@ 148 - -12,0,0,0 - @@ -61,7 +60,7 @@ @@ -76,10 +75,11 @@ - + +