diff --git a/src/.editorconfig b/src/.editorconfig index 7ee030292..ea1e3c700 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -1,142 +1,205 @@ +# editorconfig.org + +# top-most EditorConfig file root = true -# All files + +# Default settings: +# A newline ending every file +# Use 4 spaces as indentation [*] +insert_final_newline = true indent_style = space - -# XML project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 - -# XML config files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] -indent_size = 2 - -# Code files -[*.{cs,csx,vb,vbx}] indent_size = 4 -insert_final_newline = true -charset = utf-8-bom +trim_trailing_whitespace = true -############################### -# .NET Coding Conventions # -############################### -[*.{cs,vb}] -# Organize usings -dotnet_sort_system_directives_first = true -# this. preferences -dotnet_style_qualification_for_field = false:silent -dotnet_style_qualification_for_property = false:silent -dotnet_style_qualification_for_method = false:silent -dotnet_style_qualification_for_event = false:silent -# Language keywords vs BCL types preferences -dotnet_style_predefined_type_for_locals_parameters_members = true:silent -dotnet_style_predefined_type_for_member_access = true:silent -# Parentheses preferences +# Generated code +[*{_AssemblyInfo.cs,.notsupported.cs,AsmOffsets.cs}] +generated_code = true +dotnet_style_operator_placement_when_wrapping = beginning_of_line +tab_width = 4 +end_of_line = crlf +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_explicit_tuple_names = false:silent +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion +dotnet_style_readonly_field = true:suggestion +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent +dotnet_style_allow_multiple_blank_lines_experimental = true:silent +dotnet_style_allow_statement_immediately_after_block_experimental = true:silent +dotnet_code_quality_unused_parameters = all:suggestion +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# C# files +[*.cs] +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current + # Modifier preferences -dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion + +# avoid this. unless absolutely necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# Types: use keywords instead of BCL types, and permit var only when the type is clear +csharp_style_var_for_built_in_types = false:silent +csharp_style_var_when_type_is_apparent = false:none +csharp_style_var_elsewhere = false:suggestion +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# name all constant fields using PascalCase +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# static fields should have s_ prefix +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static +dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected +dotnet_naming_style.static_prefix_style.required_prefix = s_ +dotnet_naming_style.static_prefix_style.capitalization = camel_case + +# internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case + +# Code style defaults +csharp_using_directive_placement = outside_namespace:suggestion +dotnet_sort_system_directives_first = true +csharp_prefer_braces = true:silent +csharp_preserve_single_line_blocks = true:none +csharp_preserve_single_line_statements = false:none +csharp_prefer_static_local_function = true:suggestion +csharp_prefer_simple_using_statement = false:none +csharp_style_prefer_switch_expression = true:suggestion dotnet_style_readonly_field = true:suggestion + # Expression-level preferences dotnet_style_object_initializer = true:suggestion dotnet_style_collection_initializer = true:suggestion dotnet_style_explicit_tuple_names = true:suggestion -dotnet_style_null_propagation = true:suggestion dotnet_style_coalesce_expression = true:suggestion -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion dotnet_style_prefer_inferred_tuple_names = true:suggestion dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion -dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_auto_properties = true:suggestion dotnet_style_prefer_conditional_expression_over_assignment = true:silent dotnet_style_prefer_conditional_expression_over_return = true:silent +csharp_prefer_simple_default_expression = true:suggestion -############################### -# Naming Conventions # -############################### -# Style Definitions -dotnet_naming_style.pascal_case_style.capitalization = pascal_case -# Use PascalCase for constant fields -dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields -dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style -dotnet_naming_symbols.constant_fields.applicable_kinds = field -dotnet_naming_symbols.constant_fields.applicable_accessibilities = * -dotnet_naming_symbols.constant_fields.required_modifiers = const -dotnet_style_operator_placement_when_wrapping = beginning_of_line -tab_width = 4 -end_of_line = crlf -dotnet_style_prefer_simplified_boolean_expressions = true:suggestion -dotnet_style_prefer_compound_assignment = true:suggestion -dotnet_style_prefer_simplified_interpolation = true:suggestion -dotnet_style_namespace_match_folder = true:suggestion - -############################### -# C# Coding Conventions # -############################### -[*.cs] -# var preferences -csharp_style_var_for_built_in_types = true:silent -csharp_style_var_when_type_is_apparent = true:silent -csharp_style_var_elsewhere = true:silent # Expression-bodied members -csharp_style_expression_bodied_methods = false:silent -csharp_style_expression_bodied_constructors = false:silent -csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_methods = true:silent +csharp_style_expression_bodied_constructors = true:silent +csharp_style_expression_bodied_operators = true:silent csharp_style_expression_bodied_properties = true:silent csharp_style_expression_bodied_indexers = true:silent csharp_style_expression_bodied_accessors = true:silent -# Pattern matching preferences +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = true:silent + +# Pattern matching csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion csharp_style_pattern_matching_over_as_with_null_check = true:suggestion -# Null-checking preferences +csharp_style_inlined_variable_declaration = true:suggestion + +# Null checking preferences csharp_style_throw_expression = true:suggestion csharp_style_conditional_delegate_call = true:suggestion -# Modifier preferences -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion -# Expression-level preferences -csharp_prefer_braces = true:silent -csharp_style_deconstructed_variable_declaration = true:suggestion -csharp_prefer_simple_default_expression = true:suggestion -csharp_style_pattern_local_over_anonymous_function = true:suggestion -csharp_style_inlined_variable_declaration = true:suggestion -############################### -# C# Formatting Rules # -############################### -# New line preferences -csharp_new_line_before_open_brace = all -csharp_new_line_before_else = true -csharp_new_line_before_catch = true -csharp_new_line_before_finally = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_between_query_expression_clauses = true -# Indentation preferences -csharp_indent_case_contents = true -csharp_indent_switch_labels = true -csharp_indent_labels = flush_left +# Other features +csharp_style_prefer_index_operator = false:none +csharp_style_prefer_range_operator = false:none +csharp_style_pattern_local_over_anonymous_function = false:none + # Space preferences csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_parentheses = false -csharp_space_before_colon_in_inheritance_clause = true -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_around_binary_operators = before_and_after -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -csharp_space_between_method_call_name_and_opening_parenthesis = false -csharp_space_between_method_call_empty_parameter_list_parentheses = false -# Wrapping preferences -csharp_preserve_single_line_statements = true -csharp_preserve_single_line_blocks = true -csharp_using_directive_placement = outside_namespace:silent -csharp_prefer_simple_using_statement = true:suggestion +csharp_space_between_square_brackets = false csharp_style_namespace_declarations = block_scoped:silent csharp_style_prefer_method_group_conversion = true:silent csharp_style_prefer_top_level_statements = true:silent -csharp_style_expression_bodied_lambdas = true:silent -csharp_style_expression_bodied_local_functions = false:silent csharp_style_prefer_null_check_over_type_check = true:suggestion +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion +csharp_style_prefer_tuple_swap = true:suggestion +csharp_style_prefer_utf8_string_literals = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent +csharp_style_prefer_pattern_matching = true:silent +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_extended_property_pattern = true:suggestion \ No newline at end of file diff --git a/src/Wpf.Ui.Gallery/App.xaml.cs b/src/Wpf.Ui.Gallery/App.xaml.cs index bf972a4ce..0b40ddeec 100644 --- a/src/Wpf.Ui.Gallery/App.xaml.cs +++ b/src/Wpf.Ui.Gallery/App.xaml.cs @@ -61,7 +61,7 @@ public partial class App : Application services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); // Top-level pages @@ -125,9 +125,8 @@ public partial class App : Application services.AddTransient(); 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/Controls/TermsOfUseContentDialog.xaml.cs b/src/Wpf.Ui.Gallery/Controls/TermsOfUseContentDialog.xaml.cs index 7886bc746..8f7afc9b8 100644 --- a/src/Wpf.Ui.Gallery/Controls/TermsOfUseContentDialog.xaml.cs +++ b/src/Wpf.Ui.Gallery/Controls/TermsOfUseContentDialog.xaml.cs @@ -1,6 +1,7 @@ using System.Windows; using System.Windows.Controls; using Wpf.Ui.Controls; +using Wpf.Ui.Controls.ContentDialogControl; namespace Wpf.Ui.Gallery.Controls; diff --git a/src/Wpf.Ui.Gallery/ViewModels/Pages/BasicInput/ThumbRateViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Pages/BasicInput/ThumbRateViewModel.cs index 025f5f8ad..5cd329046 100644 --- a/src/Wpf.Ui.Gallery/ViewModels/Pages/BasicInput/ThumbRateViewModel.cs +++ b/src/Wpf.Ui.Gallery/ViewModels/Pages/BasicInput/ThumbRateViewModel.cs @@ -3,7 +3,8 @@ // Copyright (C) Leszek Pomianowski and WPF UI Contributors. // All Rights Reserved. -using Wpf.Ui.Controls.States; +using Wpf.Ui.Controls; +using Wpf.Ui.Controls.ThumbRateControl; namespace Wpf.Ui.Gallery.ViewModels.Pages.BasicInput; diff --git a/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/ContentDialogViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/ContentDialogViewModel.cs index 8186f1a60..5441d0c25 100644 --- a/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/ContentDialogViewModel.cs +++ b/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/ContentDialogViewModel.cs @@ -5,6 +5,7 @@ using System.Windows; using Wpf.Ui.Controls; +using Wpf.Ui.Controls.ContentDialogControl; using Wpf.Ui.Gallery.Controls; using Wpf.Ui.Gallery.Views.Windows; @@ -12,22 +13,26 @@ namespace Wpf.Ui.Gallery.ViewModels.Pages.DialogsAndFlyouts; public partial class ContentDialogViewModel : ObservableObject { + public ContentDialogViewModel(IContentDialogService contentDialogService) + { + _contentDialogService = contentDialogService; + } + + private readonly IContentDialogService _contentDialogService; + [ObservableProperty] private string _dialogResultText = string.Empty; [RelayCommand] private async Task OnShowDialog(object content) - { - var window = (MainWindow)Application.Current.MainWindow!; - var dialog = new ContentDialog(window.RootContentDialog) - { - Title = "Save your work?", - Content = content, - PrimaryButtonText = "Save", - SecondaryButtonText = "Don't Save", - CloseButtonText = "Cancel", - DefaultButton = ContentDialogButton.Primary, - }; + { + var dialog = _contentDialogService.CreateDialog(); + dialog.Title = "Save your work?"; + dialog.Content = content; + dialog.PrimaryButtonText = "Save"; + dialog.SecondaryButtonText = "Don't Save"; + dialog.CloseButtonText = "Cancel"; + dialog.DefaultButton = ContentDialogButton.Primary; var result = await dialog.ShowAsync(); @@ -42,9 +47,7 @@ private async Task OnShowDialog(object content) [RelayCommand] private async Task OnShowSignInContentDialog() { - var window = (MainWindow)Application.Current.MainWindow!; - var termsOfUseContentDialog = new TermsOfUseContentDialog(window.RootContentDialog); - + var termsOfUseContentDialog = new TermsOfUseContentDialog(_contentDialogService.GetContentPresenter()); await termsOfUseContentDialog.ShowAsync(); } } 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/Pages/DialogsAndFlyouts/MessageBoxViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/MessageBoxViewModel.cs index 28ac2ddbb..1bda84ed3 100644 --- a/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/MessageBoxViewModel.cs +++ b/src/Wpf.Ui.Gallery/ViewModels/Pages/DialogsAndFlyouts/MessageBoxViewModel.cs @@ -21,7 +21,7 @@ private void OnOpenStandardMessageBox(object sender) [RelayCommand] private async void OnOpenCustomMessageBox(object sender) { - var uiMessageBox = new Wpf.Ui.Controls.MessageBox + var uiMessageBox = new Wpf.Ui.Controls.MessageBoxControl.MessageBox { Title = "WPF UI Message Box", Content = "Never gonna give you up, never gonna let you down Never gonna run around and desert you Never gonna make you cry, never gonna say goodbye", 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/ContentDialog.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/ContentDialog.xaml.cs index 7a37a7caf..9ac821899 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/ContentDialog.xaml.cs +++ b/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/ContentDialog.xaml.cs @@ -4,16 +4,21 @@ // All Rights Reserved. -using System.Windows.Controls; +using Wpf.Ui.Controls.Navigation; using Wpf.Ui.Gallery.ViewModels.Pages.DialogsAndFlyouts; namespace Wpf.Ui.Gallery.Views.Pages.DialogsAndFlyouts; -public partial class ContentDialogPage : Page +public partial class ContentDialogPage : INavigableView { - public ContentDialogPage() + public ContentDialogPage(ContentDialogViewModel viewModel) { + ViewModel = viewModel; + DataContext = viewModel; + DataContext = viewModel; + InitializeComponent(); - DataContext = new ContentDialogViewModel(); } + + public ContentDialogViewModel ViewModel { get; } } 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 - - - - - - - - - - - - - - - - - -