From 4526e67e0b77531cba1db36ca9c4b29de981da77 Mon Sep 17 00:00:00 2001 From: Ivan Dmitriev <42055372+IvanDmitriev1@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:00:55 +0600 Subject: [PATCH 01/15] Updated navigation --- .../Navigation/NavigationView.Navigation.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Wpf.Ui/Controls/Navigation/NavigationView.Navigation.cs b/src/Wpf.Ui/Controls/Navigation/NavigationView.Navigation.cs index 56412eecd..6de532bfb 100644 --- a/src/Wpf.Ui/Controls/Navigation/NavigationView.Navigation.cs +++ b/src/Wpf.Ui/Controls/Navigation/NavigationView.Navigation.cs @@ -117,7 +117,7 @@ public virtual bool GoBack() if (Journal.Count <= 1) return false; - var itemId = Journal[Journal.Count - 2]; + var itemId = Journal[^2]; return NavigateInternal(PageIdOrTargetTagNavigationViewsDictionary[itemId], null, false, true); } @@ -146,7 +146,7 @@ private bool TryToNavigateWithoutINavigationViewItem(Type pageType, bool addToNa private bool NavigateInternal(INavigationViewItem viewItem, object? dataContext = null, bool addToNavigationStack = false, bool isBackwardsNavigated = false) { - if (NavigationStack.Count > 0 && NavigationStack[NavigationStack.Count -1] == viewItem) + if (NavigationStack.Count > 0 && NavigationStack[^1] == viewItem) return false; Debug.WriteLineIf(EnableDebugMessages, $"DEBUG | {viewItem.Id} - {(string.IsNullOrEmpty(viewItem.TargetPageTag) ? "NO_TAG" : viewItem.TargetPageTag)} - {viewItem.TargetPageType} | NAVIGATED"); @@ -178,8 +178,8 @@ private void AddToJournal(INavigationViewItem viewItem, bool isBackwardsNavigate { if (isBackwardsNavigated) { - Journal.RemoveAt(Journal.LastIndexOf(Journal[Journal.Count - 2])); - Journal.RemoveAt(Journal.LastIndexOf(Journal[Journal.Count - 1])); + Journal.RemoveAt(Journal.LastIndexOf(Journal[^2])); + Journal.RemoveAt(Journal.LastIndexOf(Journal[^1])); _currentIndexInJournal -= 2; } @@ -192,7 +192,7 @@ private void AddToJournal(INavigationViewItem viewItem, bool isBackwardsNavigate #if DEBUG Debug.WriteLineIf(EnableDebugMessages, $"JOURNAL INDEX {_currentIndexInJournal}"); if (Journal.Count > 0) - Debug.WriteLineIf(EnableDebugMessages, $"JOURNAL LAST ELEMENT {Journal[Journal.Count - 1]}"); + Debug.WriteLineIf(EnableDebugMessages, $"JOURNAL LAST ELEMENT {Journal[^1]}"); #endif } @@ -276,7 +276,7 @@ private void RecreateNavigationStackFromHistory(INavigationViewItem item) if (!_complexNavigationStackHistory.TryGetValue(item, out var historyList) || historyList.Count == 0) return; - var latestHistory = historyList[historyList.Count - 1]; + var latestHistory = historyList[^1]; var startIndex = 0; if (latestHistory[0]!.IsMenuElement) @@ -307,7 +307,7 @@ private void RecreateNavigationStackFromHistory(INavigationViewItem item) private void AddToNavigationStackHistory(INavigationViewItem viewItem) { - var lastItem = NavigationStack[NavigationStack.Count - 1]; + var lastItem = NavigationStack[^1]; var startIndex = NavigationStack.IndexOf(viewItem); if (startIndex < 0) @@ -331,7 +331,7 @@ private void AddToNavigationStackHistory(INavigationViewItem viewItem) #endif historyList.Add(array); - var latestHistory = historyList[historyList.Count - 1]; + var latestHistory = historyList[^1]; int i = 0; for (int j = startIndex; j < NavigationStack.Count - 1; j++) From 9c7f1d0f12d2c5958067882a457a81c25fd8dff5 Mon Sep 17 00:00:00 2001 From: Ivan Dmitriev <42055372+IvanDmitriev1@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:13:41 +0600 Subject: [PATCH 02/15] Added BreadcrumbBar folder --- .../Controls/{ => Breadcrumb}/BreadcrumbBar.cs | 6 +++--- .../{ => Breadcrumb}/BreadcrumbBarItem.cs | 2 +- .../BreadcrumbBarItemClickedEventArgs.cs} | 17 ++++++++--------- .../Controls/Navigation/NavigationView.Base.cs | 1 - 4 files changed, 12 insertions(+), 14 deletions(-) rename src/Wpf.Ui/Controls/{ => Breadcrumb}/BreadcrumbBar.cs (94%) rename src/Wpf.Ui/Controls/{ => Breadcrumb}/BreadcrumbBarItem.cs (98%) rename src/Wpf.Ui/{Common/BreadcrumbBarEvent.cs => Controls/Breadcrumb/BreadcrumbBarItemClickedEventArgs.cs} (56%) diff --git a/src/Wpf.Ui/Controls/BreadcrumbBar.cs b/src/Wpf.Ui/Controls/Breadcrumb/BreadcrumbBar.cs similarity index 94% rename from src/Wpf.Ui/Controls/BreadcrumbBar.cs rename to src/Wpf.Ui/Controls/Breadcrumb/BreadcrumbBar.cs index 8cb9a0629..4f85a0612 100644 --- a/src/Wpf.Ui/Controls/BreadcrumbBar.cs +++ b/src/Wpf.Ui/Controls/Breadcrumb/BreadcrumbBar.cs @@ -45,7 +45,7 @@ public class BreadcrumbBar : System.Windows.Controls.ItemsControl /// Property for . /// public static readonly RoutedEvent ItemClickedRoutedEvent = EventManager.RegisterRoutedEvent(nameof(ItemClicked), - RoutingStrategy.Bubble, typeof(BreadcrumbBarItemClickedEvent), typeof(BreadcrumbBar)); + RoutingStrategy.Bubble, typeof(TypedEventHandler), typeof(BreadcrumbBar)); /// /// Gets or sets custom command executed after selecting the item. @@ -62,7 +62,7 @@ public ICommand Command /// /// Occurs when an item is clicked in the . /// - public event BreadcrumbBarItemClickedEvent ItemClicked + public event TypedEventHandler ItemClicked { add => AddHandler(ItemClickedRoutedEvent, value); remove => RemoveHandler(ItemClickedRoutedEvent, value); @@ -162,7 +162,7 @@ private void InteractWithItemContainer(int offsetFromEnd, Action - /// Font wegiht of the . + /// Font weight of the . /// public FontWeight SymbolIconFontWeight { diff --git a/src/Wpf.Ui/Common/BreadcrumbBarEvent.cs b/src/Wpf.Ui/Controls/Breadcrumb/BreadcrumbBarItemClickedEventArgs.cs similarity index 56% rename from src/Wpf.Ui/Common/BreadcrumbBarEvent.cs rename to src/Wpf.Ui/Controls/Breadcrumb/BreadcrumbBarItemClickedEventArgs.cs index 0e22e9c71..d56f63a1b 100644 --- a/src/Wpf.Ui/Common/BreadcrumbBarEvent.cs +++ b/src/Wpf.Ui/Controls/Breadcrumb/BreadcrumbBarItemClickedEventArgs.cs @@ -1,15 +1,14 @@ -using System.Windows; -using Wpf.Ui.Controls; -using System.Diagnostics.CodeAnalysis; +// Based on Windows UI Library +// Copyright(c) Microsoft Corporation.All rights reserved. +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT. +// Copyright (C) Leszek Pomianowski and WPF UI Contributors. +// All Rights Reserved. -namespace Wpf.Ui.Common; +using System.Windows; -/// -/// Event triggered on via . -/// -/// Current instance. -public delegate void BreadcrumbBarItemClickedEvent(BreadcrumbBar sender, BreadcrumbBarItemClickedEventArgs e); +namespace Wpf.Ui.Controls; public sealed class BreadcrumbBarItemClickedEventArgs : RoutedEventArgs { diff --git a/src/Wpf.Ui/Controls/Navigation/NavigationView.Base.cs b/src/Wpf.Ui/Controls/Navigation/NavigationView.Base.cs index 9ac3ae058..5fdcb544e 100644 --- a/src/Wpf.Ui/Controls/Navigation/NavigationView.Base.cs +++ b/src/Wpf.Ui/Controls/Navigation/NavigationView.Base.cs @@ -14,7 +14,6 @@ using System.ComponentModel; using System.Diagnostics; using System.Windows; -using Wpf.Ui.Common; namespace Wpf.Ui.Controls.Navigation; From b99c2c75581cbde7c231ea379649c1e138c3631e Mon Sep 17 00:00:00 2001 From: Ivan Dmitriev <42055372+IvanDmitriev1@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:19:49 +0600 Subject: [PATCH 03/15] Added TitleBar folder --- src/Wpf.Ui/Controls/{ => TitleBar}/TitleBar.cs | 18 +++++++++--------- .../Controls/{ => TitleBar}/TitleBarButton.cs | 1 - .../{ => TitleBar}/TitleBarButtonType.cs | 0 3 files changed, 9 insertions(+), 10 deletions(-) rename src/Wpf.Ui/Controls/{ => TitleBar}/TitleBar.cs (96%) rename src/Wpf.Ui/Controls/{ => TitleBar}/TitleBarButton.cs (99%) rename src/Wpf.Ui/Controls/{ => TitleBar}/TitleBarButtonType.cs (100%) diff --git a/src/Wpf.Ui/Controls/TitleBar.cs b/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs similarity index 96% rename from src/Wpf.Ui/Controls/TitleBar.cs rename to src/Wpf.Ui/Controls/TitleBar/TitleBar.cs index 0535b4228..9cce87c43 100644 --- a/src/Wpf.Ui/Controls/TitleBar.cs +++ b/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs @@ -153,32 +153,32 @@ public class TitleBar : System.Windows.Controls.Control, IThemeControl /// Routed event for . /// public static readonly RoutedEvent CloseClickedEvent = EventManager.RegisterRoutedEvent( - nameof(CloseClicked), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TitleBar)); + nameof(CloseClicked), RoutingStrategy.Bubble, typeof(TypedEventHandler), typeof(TitleBar)); /// /// Routed event for . /// public static readonly RoutedEvent MaximizeClickedEvent = EventManager.RegisterRoutedEvent( - nameof(MaximizeClicked), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TitleBar)); + nameof(MaximizeClicked), RoutingStrategy.Bubble, typeof(TypedEventHandler), typeof(TitleBar)); /// /// Routed event for . /// public static readonly RoutedEvent MinimizeClickedEvent = EventManager.RegisterRoutedEvent( - nameof(MinimizeClicked), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TitleBar)); + nameof(MinimizeClicked), RoutingStrategy.Bubble, typeof(TypedEventHandler), typeof(TitleBar)); /// /// Routed event for . /// public static readonly RoutedEvent HelpClickedEvent = EventManager.RegisterRoutedEvent( - nameof(HelpClicked), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TitleBar)); + nameof(HelpClicked), RoutingStrategy.Bubble, typeof(TypedEventHandler), typeof(TitleBar)); /// /// Property for . /// public static readonly DependencyProperty TemplateButtonCommandProperty = DependencyProperty.Register(nameof(TemplateButtonCommand), - typeof(Common.IRelayCommand), typeof(TitleBar), new PropertyMetadata(null)); + typeof(IRelayCommand), typeof(TitleBar), new PropertyMetadata(null)); #endregion @@ -331,7 +331,7 @@ public NotifyIcon Tray /// /// Event triggered after clicking close button. /// - public event RoutedEventHandler CloseClicked + public event TypedEventHandler CloseClicked { add => AddHandler(CloseClickedEvent, value); remove => RemoveHandler(CloseClickedEvent, value); @@ -340,7 +340,7 @@ public event RoutedEventHandler CloseClicked /// /// Event triggered after clicking maximize or restore button. /// - public event RoutedEventHandler MaximizeClicked + public event TypedEventHandler MaximizeClicked { add => AddHandler(MaximizeClickedEvent, value); remove => RemoveHandler(MaximizeClickedEvent, value); @@ -349,7 +349,7 @@ public event RoutedEventHandler MaximizeClicked /// /// Event triggered after clicking minimize button. /// - public event RoutedEventHandler MinimizeClicked + public event TypedEventHandler MinimizeClicked { add => AddHandler(MinimizeClickedEvent, value); remove => RemoveHandler(MinimizeClickedEvent, value); @@ -358,7 +358,7 @@ public event RoutedEventHandler MinimizeClicked /// /// Event triggered after clicking help button /// - public event RoutedEventHandler HelpClicked + public event TypedEventHandler HelpClicked { add => AddHandler(HelpClickedEvent, value); remove => RemoveHandler(HelpClickedEvent, value); diff --git a/src/Wpf.Ui/Controls/TitleBarButton.cs b/src/Wpf.Ui/Controls/TitleBar/TitleBarButton.cs similarity index 99% rename from src/Wpf.Ui/Controls/TitleBarButton.cs rename to src/Wpf.Ui/Controls/TitleBar/TitleBarButton.cs index 0b818f5c0..66669a00f 100644 --- a/src/Wpf.Ui/Controls/TitleBarButton.cs +++ b/src/Wpf.Ui/Controls/TitleBar/TitleBarButton.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.Windows; using System.Windows.Automation.Peers; using System.Windows.Automation.Provider; diff --git a/src/Wpf.Ui/Controls/TitleBarButtonType.cs b/src/Wpf.Ui/Controls/TitleBar/TitleBarButtonType.cs similarity index 100% rename from src/Wpf.Ui/Controls/TitleBarButtonType.cs rename to src/Wpf.Ui/Controls/TitleBar/TitleBarButtonType.cs From 03a6b3494ebcd2b787ad53813e76c1e58de5c42e Mon Sep 17 00:00:00 2001 From: Ivan Dmitriev <42055372+IvanDmitriev1@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:26:45 +0600 Subject: [PATCH 04/15] Added MessageBox folder --- .../Controls/{ => MessageBox}/MessageBox.bmp | Bin .../Controls/{ => MessageBox}/MessageBox.cs | 38 ------------------ .../Controls/MessageBox/MessageBoxButton.cs | 20 +++++++++ .../Controls/MessageBox/MessageBoxResult.cs | 21 ++++++++++ src/Wpf.Ui/Wpf.Ui.csproj | 2 +- 5 files changed, 42 insertions(+), 39 deletions(-) rename src/Wpf.Ui/Controls/{ => MessageBox}/MessageBox.bmp (100%) rename src/Wpf.Ui/Controls/{ => MessageBox}/MessageBox.cs (94%) create mode 100644 src/Wpf.Ui/Controls/MessageBox/MessageBoxButton.cs create mode 100644 src/Wpf.Ui/Controls/MessageBox/MessageBoxResult.cs diff --git a/src/Wpf.Ui/Controls/MessageBox.bmp b/src/Wpf.Ui/Controls/MessageBox/MessageBox.bmp similarity index 100% rename from src/Wpf.Ui/Controls/MessageBox.bmp rename to src/Wpf.Ui/Controls/MessageBox/MessageBox.bmp diff --git a/src/Wpf.Ui/Controls/MessageBox.cs b/src/Wpf.Ui/Controls/MessageBox/MessageBox.cs similarity index 94% rename from src/Wpf.Ui/Controls/MessageBox.cs rename to src/Wpf.Ui/Controls/MessageBox/MessageBox.cs index ea537495d..6a44c4e51 100644 --- a/src/Wpf.Ui/Controls/MessageBox.cs +++ b/src/Wpf.Ui/Controls/MessageBox/MessageBox.cs @@ -15,44 +15,6 @@ namespace Wpf.Ui.Controls; -/// -/// Defines constants that specify the default button on a . -/// -public enum MessageBoxButton -{ - /// - /// The primary button - /// - Primary, - /// - /// The secondary button - /// - Secondary, - /// - /// The close button - /// - Close -} - -/// -/// Specifies identifiers to indicate the return value of a . -/// -public enum MessageBoxResult -{ - /// - /// No button was tapped. - /// - None, - /// - /// The primary button was tapped by the user. - /// - Primary, - /// - /// The secondary button was tapped by the user. - /// - Secondary -} - /// /// Customized window for notifications. /// diff --git a/src/Wpf.Ui/Controls/MessageBox/MessageBoxButton.cs b/src/Wpf.Ui/Controls/MessageBox/MessageBoxButton.cs new file mode 100644 index 000000000..0a17afd04 --- /dev/null +++ b/src/Wpf.Ui/Controls/MessageBox/MessageBoxButton.cs @@ -0,0 +1,20 @@ +namespace Wpf.Ui.Controls; + +/// +/// Defines constants that specify the default button on a . +/// +public enum MessageBoxButton +{ + /// + /// The primary button + /// + Primary, + /// + /// The secondary button + /// + Secondary, + /// + /// The close button + /// + Close +} diff --git a/src/Wpf.Ui/Controls/MessageBox/MessageBoxResult.cs b/src/Wpf.Ui/Controls/MessageBox/MessageBoxResult.cs new file mode 100644 index 000000000..592aad9d7 --- /dev/null +++ b/src/Wpf.Ui/Controls/MessageBox/MessageBoxResult.cs @@ -0,0 +1,21 @@ +namespace Wpf.Ui.Controls +{ + /// + /// Specifies identifiers to indicate the return value of a . + /// + public enum MessageBoxResult + { + /// + /// No button was tapped. + /// + None, + /// + /// The primary button was tapped by the user. + /// + Primary, + /// + /// The secondary button was tapped by the user. + /// + Secondary + } +} diff --git a/src/Wpf.Ui/Wpf.Ui.csproj b/src/Wpf.Ui/Wpf.Ui.csproj index 385ce3c3e..e8bebde37 100644 --- a/src/Wpf.Ui/Wpf.Ui.csproj +++ b/src/Wpf.Ui/Wpf.Ui.csproj @@ -104,7 +104,7 @@ - + From 85f411382db0837a1ce4517508c0b83ef6ba02ae Mon Sep 17 00:00:00 2001 From: Ivan Dmitriev <42055372+IvanDmitriev1@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:35:48 +0600 Subject: [PATCH 05/15] Added ContentDialog folder --- .../{ => ContentDialog}/ContentDialog.cs | 38 ------------------- .../ContentDialog/ContentDialogButton.cs | 21 ++++++++++ .../ContentDialog/ContentDialogResult.cs | 21 ++++++++++ 3 files changed, 42 insertions(+), 38 deletions(-) rename src/Wpf.Ui/Controls/{ => ContentDialog}/ContentDialog.cs (95%) create mode 100644 src/Wpf.Ui/Controls/ContentDialog/ContentDialogButton.cs create mode 100644 src/Wpf.Ui/Controls/ContentDialog/ContentDialogResult.cs diff --git a/src/Wpf.Ui/Controls/ContentDialog.cs b/src/Wpf.Ui/Controls/ContentDialog/ContentDialog.cs similarity index 95% rename from src/Wpf.Ui/Controls/ContentDialog.cs rename to src/Wpf.Ui/Controls/ContentDialog/ContentDialog.cs index 06d8b981c..b8ae7b89c 100644 --- a/src/Wpf.Ui/Controls/ContentDialog.cs +++ b/src/Wpf.Ui/Controls/ContentDialog/ContentDialog.cs @@ -12,44 +12,6 @@ namespace Wpf.Ui.Controls; -/// -/// Specifies identifiers to indicate the return value of a . -/// -public enum ContentDialogResult -{ - /// - /// No button was tapped. - /// - None, - /// - /// The primary button was tapped by the user. - /// - Primary, - /// - /// The secondary button was tapped by the user. - /// - Secondary -} - -/// -/// Defines constants that specify the default button on a . -/// -public enum ContentDialogButton -{ - /// - /// The primary button is the default. - /// - Primary, - /// - /// The secondary button is the default. - /// - Secondary, - /// - /// The close button is the default. - /// - Close -} - public class ContentDialog : ContentControl { #region Static proerties diff --git a/src/Wpf.Ui/Controls/ContentDialog/ContentDialogButton.cs b/src/Wpf.Ui/Controls/ContentDialog/ContentDialogButton.cs new file mode 100644 index 000000000..d257d70f1 --- /dev/null +++ b/src/Wpf.Ui/Controls/ContentDialog/ContentDialogButton.cs @@ -0,0 +1,21 @@ +namespace Wpf.Ui.Controls +{ + /// + /// Defines constants that specify the default button on a . + /// + public enum ContentDialogButton + { + /// + /// The primary button is the default. + /// + Primary, + /// + /// The secondary button is the default. + /// + Secondary, + /// + /// The close button is the default. + /// + Close + } +} diff --git a/src/Wpf.Ui/Controls/ContentDialog/ContentDialogResult.cs b/src/Wpf.Ui/Controls/ContentDialog/ContentDialogResult.cs new file mode 100644 index 000000000..a483d3f31 --- /dev/null +++ b/src/Wpf.Ui/Controls/ContentDialog/ContentDialogResult.cs @@ -0,0 +1,21 @@ +namespace Wpf.Ui.Controls +{ + /// + /// Specifies identifiers to indicate the return value of a . + /// + public enum ContentDialogResult + { + /// + /// No button was tapped. + /// + None, + /// + /// The primary button was tapped by the user. + /// + Primary, + /// + /// The secondary button was tapped by the user. + /// + Secondary + } +} From 55fc713248bd7382aa1eb628b4258fa312f90a56 Mon Sep 17 00:00:00 2001 From: Ivan Dmitriev <42055372+IvanDmitriev1@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:46:24 +0600 Subject: [PATCH 06/15] Deleted Dialog control --- src/Wpf.Ui.Gallery/App.xaml.cs | 3 - .../DialogsAndFlyouts/DialogViewModel.cs | 52 --- .../ViewModels/Windows/MainWindowViewModel.cs | 1 - .../Pages/DialogsAndFlyouts/DialogPage.xaml | 60 --- .../DialogsAndFlyouts/DialogPage.xaml.cs | 23 -- .../Views/Windows/EditorWindow.xaml | 4 +- .../Views/Windows/MainWindow.xaml | 6 - .../Views/Windows/MainWindow.xaml.cs | 9 +- src/Wpf.Ui/Common/RoutedDialogEvent.cs | 19 - src/Wpf.Ui/Contracts/IDialogService.cs | 26 -- src/Wpf.Ui/Controls/Dialog.bmp | Bin 824 -> 0 bytes src/Wpf.Ui/Controls/Dialog.cs | 372 ------------------ src/Wpf.Ui/Controls/DialogButtonPressed.cs | 27 -- src/Wpf.Ui/Controls/IDialogControl.cs | 116 ------ src/Wpf.Ui/Services/DialogService.cs | 34 -- src/Wpf.Ui/Styles/Controls/Dialog.xaml | 166 -------- src/Wpf.Ui/Styles/Wpf.Ui.xaml | 1 - src/Wpf.Ui/Wpf.Ui.csproj | 1 - 18 files changed, 4 insertions(+), 916 deletions(-) delete mode 100644 src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/DialogViewModel.cs delete mode 100644 src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogPage.xaml delete mode 100644 src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogPage.xaml.cs delete mode 100644 src/Wpf.Ui/Common/RoutedDialogEvent.cs delete mode 100644 src/Wpf.Ui/Contracts/IDialogService.cs delete mode 100644 src/Wpf.Ui/Controls/Dialog.bmp delete mode 100644 src/Wpf.Ui/Controls/Dialog.cs delete mode 100644 src/Wpf.Ui/Controls/DialogButtonPressed.cs delete mode 100644 src/Wpf.Ui/Controls/IDialogControl.cs delete mode 100644 src/Wpf.Ui/Services/DialogService.cs delete mode 100644 src/Wpf.Ui/Styles/Controls/Dialog.xaml diff --git a/src/Wpf.Ui.Gallery/App.xaml.cs b/src/Wpf.Ui.Gallery/App.xaml.cs index bf972a4ce..32cb3e0c4 100644 --- a/src/Wpf.Ui.Gallery/App.xaml.cs +++ b/src/Wpf.Ui.Gallery/App.xaml.cs @@ -61,7 +61,6 @@ public partial class App : Application services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); // Top-level pages @@ -125,9 +124,7 @@ public partial class App : Application services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/DialogViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/DialogViewModel.cs deleted file mode 100644 index 3030211ba..000000000 --- a/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/DialogViewModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT. -// Copyright (C) Leszek Pomianowski and WPF UI Contributors. -// All Rights Reserved. - -using System.Windows; -using System.Windows.Controls; - -namespace Wpf.Ui.Gallery.ViewModels.Pages.DialogsAndFlyouts; - -public partial class DialogViewModel : ObservableObject -{ - private readonly IDialogService _dialogService; - public DialogViewModel(IDialogService dialogService) - { - _dialogService = dialogService; - } - - [RelayCommand] - private void OnShowDialog(object sender) - { - var rootDialog = _dialogService.GetDialogControl(); - - rootDialog.DialogHeight = 240; - rootDialog.Header = "This is global Dialog control managed by IDialogService"; - rootDialog.Content = new TextBlock - { - Margin = new Thickness(0, 8, 0, 0), - TextWrapping = TextWrapping.WrapWithOverflow, - Text = "This dialog is placed under the TitleBar but above the NavigationView. This allows us to enable the window to be navigated, but cover the application's navigation. You can add Dialog anywhere you want and arrange it as you like." - }; - - var buttonLeft = new Wpf.Ui.Controls.Button - { - Content = "Left button", - Appearance = Ui.Controls.ControlAppearance.Primary, - HorizontalAlignment = HorizontalAlignment.Stretch - }; - buttonLeft.Click += (_, _) => rootDialog.Hide(); - rootDialog.ButtonLeft = buttonLeft; - - var buttonRight = new Wpf.Ui.Controls.Button - { - Content = "Right button", - HorizontalAlignment = HorizontalAlignment.Stretch - }; - buttonRight.Click += (_, _) => rootDialog.Hide(); - rootDialog.ButtonRight = buttonRight; - - rootDialog.Show(); - } -} diff --git a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs index a4dfdf535..b8afd5e36 100644 --- a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs +++ b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs @@ -76,7 +76,6 @@ public MainWindowViewModel(IServiceProvider serviceProvider) new NavigationViewItem {Content = "Dialogs and Flyouts", Icon = new SymbolIcon { Symbol = SymbolRegular.Chat24 }, TargetPageType = typeof(DialogsAndFlyoutsPage), MenuItems = new ObservableCollection { new NavigationViewItem { Content = "Snackbar", TargetPageType = typeof(SnackbarPage) }, - new NavigationViewItem { Content = "Dialog", TargetPageType = typeof(DialogPage) }, new NavigationViewItem { Content = "ContentDialog", TargetPageType = typeof(ContentDialogPage) }, new NavigationViewItem { Content = "Flyout", TargetPageType = typeof(FlyoutPage) }, new NavigationViewItem { Content = "MessageBox", TargetPageType = typeof(MessageBoxPage) }, diff --git a/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogPage.xaml deleted file mode 100644 index 1a5f14702..000000000 --- a/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogPage.xaml +++ /dev/null @@ -1,60 +0,0 @@ - - - https://github.com/lepoco/wpfui/blob/development/src/Wpf.Ui/Styles/Controls/Dialog.xaml - https://github.com/lepoco/wpfui/blob/development/src/Wpf.Ui/Controls/Dialog.cs - - - - - - - - - - - - - - - - - -