From 94f4c4e3ac07ce4c57c1b7b7f0ec611c4ede7055 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 19 Mar 2024 11:09:43 +0000 Subject: [PATCH 01/11] Attempted fix still issues Attempted fix still issues --- .../App.axaml | 6 +- .../JamSoft.AvaloniaUI.Dialogs.Sample.csproj | 10 +- .../CustomBaseChildWindowViewModel.cs | 5 +- .../ViewModels/MainWindowViewModel.cs | 5 +- .../Controls/Wizard.cs | 10 +- .../Controls/WizardContainerGenerator.cs | 95 ++++++++++++++++--- .../Controls/WizardStep.cs | 4 +- .../DialogService.cs | 66 +++++++------ .../Helpers/CommonFilters.cs | 86 +++++++++-------- .../IDialogService.cs | 7 +- .../JamSoft.AvaloniaUI.Dialogs.csproj | 5 +- .../Themes/WizardStyle.axaml | 4 +- .../ViewModels/ChildWindowViewModel.cs | 6 +- .../Views/ChildWindow.axaml.cs | 15 +-- .../Views/DialogWindow.axaml.cs | 2 +- 15 files changed, 208 insertions(+), 118 deletions(-) diff --git a/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml b/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml index e59edd5..fe4bf3c 100644 --- a/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml +++ b/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml @@ -4,7 +4,11 @@ x:Class="JamSoft.AvaloniaUI.Dialogs.Sample.App"> - + + + + + + + @@ -72,9 +78,11 @@ + + From bceb51eda0ee0171c58890ff3c94f0f0aaa55f00 Mon Sep 17 00:00:00 2001 From: Jammer Date: Mon, 22 Apr 2024 19:07:14 +0100 Subject: [PATCH 05/11] Formatted code Formatted code --- .../Views/MyWizardView.axaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyWizardView.axaml b/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyWizardView.axaml index 1100636..56f0f8d 100644 --- a/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyWizardView.axaml +++ b/src/JamSoft.AvaloniaUI.Dialogs.Sample/Views/MyWizardView.axaml @@ -8,7 +8,7 @@ x:Class="JamSoft.AvaloniaUI.Dialogs.Sample.Views.MyWizardView"> @@ -54,7 +54,7 @@ - + From 07f6d7faeac61deabcdd6fd3eff568a5a1d79ee8 Mon Sep 17 00:00:00 2001 From: Jammer Date: Mon, 22 Apr 2024 19:07:25 +0100 Subject: [PATCH 06/11] Added Stroke Added Stroke --- src/JamSoft.AvaloniaUI.Dialogs/Themes/WizardStepStyle.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JamSoft.AvaloniaUI.Dialogs/Themes/WizardStepStyle.axaml b/src/JamSoft.AvaloniaUI.Dialogs/Themes/WizardStepStyle.axaml index 05c59fd..7c514ca 100644 --- a/src/JamSoft.AvaloniaUI.Dialogs/Themes/WizardStepStyle.axaml +++ b/src/JamSoft.AvaloniaUI.Dialogs/Themes/WizardStepStyle.axaml @@ -34,7 +34,7 @@ CornerRadius="{TemplateBinding CornerRadius}" Padding="{TemplateBinding Padding}"> - + From 95afecf4de1e88cd7ad0766f60fe5d46f2058a79 Mon Sep 17 00:00:00 2001 From: Jammer Date: Mon, 22 Apr 2024 19:07:49 +0100 Subject: [PATCH 07/11] Updated dependent Avalonia version Updated dependent Avalonia version --- .../JamSoft.AvaloniaUI.Dialogs.Sample.csproj | 10 +++++----- .../JamSoft.AvaloniaUI.Dialogs.csproj | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/JamSoft.AvaloniaUI.Dialogs.Sample/JamSoft.AvaloniaUI.Dialogs.Sample.csproj b/src/JamSoft.AvaloniaUI.Dialogs.Sample/JamSoft.AvaloniaUI.Dialogs.Sample.csproj index 1227b7a..6df7f59 100644 --- a/src/JamSoft.AvaloniaUI.Dialogs.Sample/JamSoft.AvaloniaUI.Dialogs.Sample.csproj +++ b/src/JamSoft.AvaloniaUI.Dialogs.Sample/JamSoft.AvaloniaUI.Dialogs.Sample.csproj @@ -20,12 +20,12 @@ - - - + + + - - + + diff --git a/src/JamSoft.AvaloniaUI.Dialogs/JamSoft.AvaloniaUI.Dialogs.csproj b/src/JamSoft.AvaloniaUI.Dialogs/JamSoft.AvaloniaUI.Dialogs.csproj index 73622eb..eb9f792 100644 --- a/src/JamSoft.AvaloniaUI.Dialogs/JamSoft.AvaloniaUI.Dialogs.csproj +++ b/src/JamSoft.AvaloniaUI.Dialogs/JamSoft.AvaloniaUI.Dialogs.csproj @@ -21,11 +21,11 @@ true JamSoft.AssemblyKeyFile.snk true - 1.1.4 - 1.1.4.0 - 1.1.4.0 + 1.2.0 + 1.2.0.0 + 1.2.0.0 MIT - 1.1.4.0-rel + 1.2.0.0-rel true README.md @@ -40,10 +40,10 @@ - + - - + + From 9fada508422cba67f0aa00f9c9364d4d08b69858 Mon Sep 17 00:00:00 2001 From: Jammer Date: Mon, 22 Apr 2024 19:08:03 +0100 Subject: [PATCH 08/11] Removed custom Style Removed custom Style --- src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml b/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml index fe4bf3c..e0f60fb 100644 --- a/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml +++ b/src/JamSoft.AvaloniaUI.Dialogs.Sample/App.axaml @@ -19,9 +19,9 @@ - + + + + From 99fc68fc6aeccbb771a31f2b41a12d8e8afde432 Mon Sep 17 00:00:00 2001 From: Jammer Date: Mon, 22 Apr 2024 19:08:28 +0100 Subject: [PATCH 09/11] Code formatting and binding type updated Code formatting and binding type updated --- .../Controls/Wizard.cs | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/JamSoft.AvaloniaUI.Dialogs/Controls/Wizard.cs b/src/JamSoft.AvaloniaUI.Dialogs/Controls/Wizard.cs index e58ab8d..b9d8c0e 100644 --- a/src/JamSoft.AvaloniaUI.Dialogs/Controls/Wizard.cs +++ b/src/JamSoft.AvaloniaUI.Dialogs/Controls/Wizard.cs @@ -40,7 +40,7 @@ public class Wizard : TemplatedControl /// /// The index of the active WizardStep /// - public int SelectedIndex { get; set; } = 0; + public int SelectedIndex { get; set; } /// /// Defines the property. @@ -51,7 +51,7 @@ public class Wizard : TemplatedControl o => o.SelectedIndex, (o, v) => o.SelectedIndex = v, unsetValue: 0, - defaultBindingMode: BindingMode.TwoWay); + defaultBindingMode: BindingMode.OneWay); /// /// Defines the property. @@ -96,32 +96,32 @@ public class Wizard : TemplatedControl /// /// Defines the property. /// - public static readonly StyledProperty NextButtonContentProperty = - AvaloniaProperty.Register(nameof(NextButtonContent), "Next"); + public static readonly StyledProperty NextButtonContentProperty = + AvaloniaProperty.Register(nameof(NextButtonContent), "Next"); /// /// Defines the property. /// - public static readonly StyledProperty PreviousButtonContentProperty = - AvaloniaProperty.Register(nameof(PreviousButtonContent), "Back"); + public static readonly StyledProperty PreviousButtonContentProperty = + AvaloniaProperty.Register(nameof(PreviousButtonContent), "Back"); /// /// Defines the property. /// - public static readonly StyledProperty CompleteButtonContentProperty = - AvaloniaProperty.Register(nameof(CompleteButtonContent), "Complete"); + public static readonly StyledProperty CompleteButtonContentProperty = + AvaloniaProperty.Register(nameof(CompleteButtonContent), "Complete"); /// /// Defines the property. /// - public static readonly StyledProperty?> StepsProperty = - AvaloniaProperty.Register?>(nameof(Steps)); + public static readonly StyledProperty?> StepsProperty = + AvaloniaProperty.Register?>(nameof(Steps)); /// /// Gets or sets a collection used to generate the content of the . /// [Content] - public List? Steps + public IList? Steps { get => GetValue(StepsProperty); set => SetValue(StepsProperty, value); @@ -191,7 +191,7 @@ public IDataTemplate? SelectedContentTemplate /// /// Next button content /// - public object NextButtonContent + public object? NextButtonContent { get { return GetValue(NextButtonContentProperty); } set { SetValue(NextButtonContentProperty, value); } @@ -200,7 +200,7 @@ public object NextButtonContent /// /// Previous button content /// - public object PreviousButtonContent + public object? PreviousButtonContent { get { return GetValue(PreviousButtonContentProperty); } set { SetValue(PreviousButtonContentProperty, value); } @@ -209,7 +209,7 @@ public object PreviousButtonContent /// /// Complete button content /// - public object CompleteButtonContent + public object? CompleteButtonContent { get { return GetValue(CompleteButtonContentProperty); } set { SetValue(CompleteButtonContentProperty, value); } @@ -227,7 +227,7 @@ private void StepCompleted(AvaloniaPropertyChangedEventArgs args) } var list = Steps; - if (args.Sender.Equals(list.LastOrDefault()) && (args.NewValue is bool && (bool)args.NewValue)) + if (args.Sender.Equals(list?.LastOrDefault()) && (args.NewValue is bool value && value)) { CompleteButton!.IsEnabled = true; } @@ -239,16 +239,25 @@ private void StepCompleted(AvaloniaPropertyChangedEventArgs args) private void UpdateSelectedContent() { - if (ContentPart != null) + if (ContentPart == null) return; + + if (SelectedItem != null && Steps?[SelectedIndex] != null) + { + SelectedItem.IsSelected = false; + } + + SelectedItem = Steps?[SelectedIndex]; + + if (SelectedItem != null) { - SelectedItem = Steps?[SelectedIndex]; - ContentPart.SetValue(ContentControl.ContentProperty, SelectedItem?.Content); + ContentPart.SetValue(ContentControl.ContentProperty, SelectedItem.Content); + SelectedItem.IsSelected = true; } } private void HandleDataContextChanged() { - WizardStep.StepCompleteProperty.Changed.AddClassHandler((x, args) => StepCompleted(args)); + WizardStep.StepCompleteProperty.Changed.AddClassHandler((_, args) => StepCompleted(args)); } /// @@ -322,7 +331,7 @@ private void SetButtons() var list = Steps; var selected = SelectedItem; - if (selected!.Equals(list.LastOrDefault())) + if (selected!.Equals(list?.LastOrDefault())) { NextButton!.IsVisible = false; CompleteButton!.IsVisible = true; From 35e790d5e17d792de7da57e3dd159b2003eddc6f Mon Sep 17 00:00:00 2001 From: Jammer Date: Mon, 22 Apr 2024 19:19:52 +0100 Subject: [PATCH 10/11] Updated readme Updated readme --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6e79940..cd4e1c3 100644 --- a/README.md +++ b/README.md @@ -16,16 +16,16 @@ https://jamsoft.github.io/JamSoft.AvaloniaUI.Dialogs/ ## Installation ```shell -dotnet add package JamSoft.AvaloniaUI.Dialogs --version 1.1.4 +dotnet add package JamSoft.AvaloniaUI.Dialogs --version 1.2.0 ``` ```shell -Install-Package JamSoft.AvaloniaUI.Dialogs -Version 1.1.4 +Install-Package JamSoft.AvaloniaUI.Dialogs -Version 1.2.0 ``` ```xml - + ``` ```shell -paket add JamSoft.AvaloniaUI.Dialogs --version 1.1.4 +paket add JamSoft.AvaloniaUI.Dialogs --version 1.2.0 ``` ## Import Styles ### All Defaults @@ -368,7 +368,8 @@ See the Sample Application for a complete implementation example and guidance. You can easily target elements of the dialogs via their names and types, such as: ```xml - + + @@ -382,7 +383,13 @@ You can easily target elements of the dialogs via their names and types, such as - + + + + ``` \ No newline at end of file From 4359a90aadbd3c820fb2aae03e4c0c158e4e0ebd Mon Sep 17 00:00:00 2001 From: Jammer Date: Mon, 22 Apr 2024 19:29:22 +0100 Subject: [PATCH 11/11] Updated comments Updated comments --- .../Helpers/CommonFiltersExtensionMethods.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/JamSoft.AvaloniaUI.Dialogs/Helpers/CommonFiltersExtensionMethods.cs b/src/JamSoft.AvaloniaUI.Dialogs/Helpers/CommonFiltersExtensionMethods.cs index 3d872d6..9b12142 100644 --- a/src/JamSoft.AvaloniaUI.Dialogs/Helpers/CommonFiltersExtensionMethods.cs +++ b/src/JamSoft.AvaloniaUI.Dialogs/Helpers/CommonFiltersExtensionMethods.cs @@ -2,8 +2,18 @@ namespace JamSoft.AvaloniaUI.Dialogs.Helpers; +/// +/// A class containing extension methods for to allow for easier merging of file types. +/// public static class CommonFiltersExtensionMethods { + /// + /// Merges the specified file type with the other file types. + /// + /// + /// + /// + /// public static FilePickerFileType MergeWith(this FilePickerFileType fileType, FilePickerFileType[] others, string? name) { if (!string.IsNullOrWhiteSpace(name)) @@ -29,6 +39,13 @@ public static FilePickerFileType MergeWith(this FilePickerFileType fileType, Fil return fileType; } + /// + /// merges the specified file type with the other file type. + /// + /// + /// + /// + /// public static FilePickerFileType MergeWith(this FilePickerFileType fileType, FilePickerFileType? other, string? name = null) { if (other == null)