diff --git a/.editorconfig b/.editorconfig index 100358608..38c62724d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,24 +15,8 @@ indent_size = 4 indent_style = space # New line preferences -end_of_line = crlf +end_of_line = unset insert_final_newline = false -dotnet_style_operator_placement_when_wrapping = beginning_of_line -dotnet_style_coalesce_expression = true:suggestion -dotnet_style_null_propagation = true:suggestion -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning -dotnet_style_prefer_auto_properties = true:silent -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 = true:suggestion -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 #### Build files #### @@ -73,7 +57,7 @@ dotnet_style_qualification_for_property = false:warning # Language keywords vs BCL types preferences dotnet_style_predefined_type_for_locals_parameters_members = true:warning -dotnet_style_predefined_type_for_member_access = false:warning +dotnet_style_predefined_type_for_member_access = true:warning # Parentheses preferences dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent @@ -111,8 +95,8 @@ dotnet_style_readonly_field = true:warning # var preferences csharp_style_var_elsewhere = false:warning -csharp_style_var_for_built_in_types = true:warning -csharp_style_var_when_type_is_apparent = true:warning +csharp_style_var_for_built_in_types = false:warning +csharp_style_var_when_type_is_apparent = false:warning # Expression-bodied members csharp_style_expression_bodied_accessors = false:silent @@ -241,9 +225,9 @@ dotnet_naming_style.prefix_interface_interface_with_i.required_prefix # Naming Rules # Async -dotnet_naming_rule.async_methods_end_in_async.severity = silent +dotnet_naming_rule.async_methods_end_in_async.severity = silent dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods -dotnet_naming_rule.async_methods_end_in_async.style = end_in_async +dotnet_naming_rule.async_methods_end_in_async.style = end_in_async dotnet_naming_symbols.any_async_methods.applicable_kinds = method dotnet_naming_symbols.any_async_methods.applicable_accessibilities = * @@ -253,45 +237,45 @@ dotnet_naming_style.end_in_async.required_suffix dotnet_naming_style.end_in_async.capitalization = pascal_case # Constant fields must be PascalCase -dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = silent +dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = silent dotnet_naming_rule.constant_fields_must_be_pascal_case.symbols = constant_fields -dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case +dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case # Public, internal and protected readonly fields must be PascalCase -dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.severity = silent +dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.severity = silent dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.symbols = non_private_readonly_fields -dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.style = pascal_case +dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.style = pascal_case # Static readonly fields must be PascalCase -dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = silent +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = silent dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.symbols = static_readonly_fields -dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = pascal_case +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = pascal_case # Private readonly fields must be camelCase -dotnet_naming_rule.private_readonly_fields_must_be_camel_case.severity = silent +dotnet_naming_rule.private_readonly_fields_must_be_camel_case.severity = silent dotnet_naming_rule.private_readonly_fields_must_be_camel_case.symbols = private_readonly_fields -dotnet_naming_rule.private_readonly_fields_must_be_camel_case.style = camel_case +dotnet_naming_rule.private_readonly_fields_must_be_camel_case.style = camel_case # Public and internal fields must be PascalCase -dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.severity = silent +dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.severity = silent dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.symbols = public_internal_protected_fields -dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.style = pascal_case +dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.style = pascal_case # Private and protected fields must be camelCase -dotnet_naming_rule.private_fields_must_be_camel_case.severity = silent +dotnet_naming_rule.private_fields_must_be_camel_case.severity = silent dotnet_naming_rule.private_fields_must_be_camel_case.symbols = private_protected_fields -dotnet_naming_rule.private_fields_must_be_camel_case.style = prefix_private_field_with_underscore +dotnet_naming_rule.private_fields_must_be_camel_case.style = prefix_private_field_with_underscore # Public members must be capitalized -dotnet_naming_rule.public_members_must_be_capitalized.severity = silent +dotnet_naming_rule.public_members_must_be_capitalized.severity = silent dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols -dotnet_naming_rule.public_members_must_be_capitalized.style = first_upper +dotnet_naming_rule.public_members_must_be_capitalized.style = first_upper # Parameters must be camelCase -dotnet_naming_rule.parameters_must_be_camel_case.severity = silent +dotnet_naming_rule.parameters_must_be_camel_case.severity = silent dotnet_naming_rule.parameters_must_be_camel_case.symbols = parameters -dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case +dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case # Class, struct, enum and delegates must be PascalCase -dotnet_naming_rule.non_interface_types_must_be_pascal_case.severity = silent +dotnet_naming_rule.non_interface_types_must_be_pascal_case.severity = silent dotnet_naming_rule.non_interface_types_must_be_pascal_case.symbols = non_interface_types -dotnet_naming_rule.non_interface_types_must_be_pascal_case.style = pascal_case +dotnet_naming_rule.non_interface_types_must_be_pascal_case.style = pascal_case # Interfaces must be PascalCase and start with an 'I' -dotnet_naming_rule.interface_types_must_be_prefixed_with_i.severity = silent +dotnet_naming_rule.interface_types_must_be_prefixed_with_i.severity = silent dotnet_naming_rule.interface_types_must_be_prefixed_with_i.symbols = interface_types -dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style = prefix_interface_interface_with_i +dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style = prefix_interface_interface_with_i # prefix_private_field_with_underscore - Private fields must be prefixed with _ dotnet_naming_style.prefix_private_field_with_underscore.capitalization = camel_case dotnet_naming_style.prefix_private_field_with_underscore.required_prefix = _ @@ -361,12 +345,6 @@ dotnet_diagnostic.CA2240.severity = warning dotnet_diagnostic.CA2241.severity = warning dotnet_diagnostic.CA2242.severity = warning -# Stylecop Analyzers -dotnet_diagnostic.SA1111.severity = none -dotnet_diagnostic.SA1121.severity = none -dotnet_diagnostic.SA1208.severity = none -dotnet_diagnostic.SA1518.severity = none - # Require file header OR A source file contains a header that does not match the required text dotnet_diagnostic.IDE0073.severity = error @@ -409,8 +387,13 @@ dotnet_diagnostic.SA1629.severity = none dotnet_diagnostic.SA1633.severity = none dotnet_diagnostic.SA1634.severity = none dotnet_diagnostic.SA1652.severity = none -csharp_prefer_simple_using_statement = true:suggestion -csharp_style_prefer_method_group_conversion = true:silent -csharp_style_prefer_top_level_statements = true:silent -csharp_style_expression_bodied_local_functions = false:silent -csharp_style_prefer_null_check_over_type_check = true:suggestion + +dotnet_diagnostic.IDE0009.severity = none + +# Additional Stylecop Analyzers +dotnet_diagnostic.SA1111.severity = none +dotnet_diagnostic.SA1121.severity = none +dotnet_diagnostic.SA1204.severity = none +dotnet_diagnostic.SA1208.severity = none +dotnet_diagnostic.SA1518.severity = none +dotnet_diagnostic.SA1615.severity = none diff --git a/.github/labeler.yml b/.github/labeler.yml index cb16e8682..f1ce31c7d 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -46,7 +46,7 @@ controls: navigation: - changed-files: - - any-glob-to-any-file: 'src/Wpf.Ui/Controls/NavigationView/' + - any-glob-to-any-file: 'src/Wpf.Ui/Controls/NavigationView/**' gallery: - changed-files: diff --git a/Directory.Build.props b/Directory.Build.props index 2f9b63d5b..a46c1bf6c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,18 +1,11 @@ - 3.0.2 + 3.0.3 12.0 true - - true - moderate - true - false - - lepo.co lepo.co @@ -37,6 +30,14 @@ README.md + + true + moderate + true + false + true + + diff --git a/src/Wpf.Ui.Demo.Console/Wpf.Ui.Demo.Console.csproj b/src/Wpf.Ui.Demo.Console/Wpf.Ui.Demo.Console.csproj index 8112c10c0..fb5496e36 100644 --- a/src/Wpf.Ui.Demo.Console/Wpf.Ui.Demo.Console.csproj +++ b/src/Wpf.Ui.Demo.Console/Wpf.Ui.Demo.Console.csproj @@ -7,6 +7,7 @@ enable true wpfui.ico + $(NoWarn);SA1601 diff --git a/src/Wpf.Ui.Demo.Mvvm/Wpf.Ui.Demo.Mvvm.csproj b/src/Wpf.Ui.Demo.Mvvm/Wpf.Ui.Demo.Mvvm.csproj index e61101205..1f3462e02 100644 --- a/src/Wpf.Ui.Demo.Mvvm/Wpf.Ui.Demo.Mvvm.csproj +++ b/src/Wpf.Ui.Demo.Mvvm/Wpf.Ui.Demo.Mvvm.csproj @@ -10,6 +10,7 @@ app.manifest applicationIcon.ico AnyCPU;x64 + $(NoWarn);SA1601 diff --git a/src/Wpf.Ui.Demo.Simple/Wpf.Ui.Demo.Simple.csproj b/src/Wpf.Ui.Demo.Simple/Wpf.Ui.Demo.Simple.csproj index 964b9e2d9..1d6697725 100644 --- a/src/Wpf.Ui.Demo.Simple/Wpf.Ui.Demo.Simple.csproj +++ b/src/Wpf.Ui.Demo.Simple/Wpf.Ui.Demo.Simple.csproj @@ -9,6 +9,7 @@ app.manifest applicationIcon.ico AnyCPU;x64 + $(NoWarn);SA1601 diff --git a/src/Wpf.Ui.Extension.Template.Blank/App.xaml.cs b/src/Wpf.Ui.Extension.Template.Blank/App.xaml.cs index 6bc1b608b..12f11be2c 100644 --- a/src/Wpf.Ui.Extension.Template.Blank/App.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Blank/App.xaml.cs @@ -1,9 +1,4 @@ -// 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 Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using System.IO; using System.Reflection; diff --git a/src/Wpf.Ui.Extension.Template.Blank/AssemblyInfo.cs b/src/Wpf.Ui.Extension.Template.Blank/AssemblyInfo.cs index 688391b05..77c6c5db5 100644 --- a/src/Wpf.Ui.Extension.Template.Blank/AssemblyInfo.cs +++ b/src/Wpf.Ui.Extension.Template.Blank/AssemblyInfo.cs @@ -1,8 +1,3 @@ -// 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; [assembly: ThemeInfo( diff --git a/src/Wpf.Ui.Extension.Template.Blank/Wpf.Ui.Blank.csproj b/src/Wpf.Ui.Extension.Template.Blank/Wpf.Ui.Blank.csproj index 374f7bdb3..1eeee3598 100644 --- a/src/Wpf.Ui.Extension.Template.Blank/Wpf.Ui.Blank.csproj +++ b/src/Wpf.Ui.Extension.Template.Blank/Wpf.Ui.Blank.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Wpf.Ui.Extension.Template.Compact/App.xaml.cs b/src/Wpf.Ui.Extension.Template.Compact/App.xaml.cs index dd6c6fb95..bcedf63e4 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/App.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/App.xaml.cs @@ -1,9 +1,4 @@ -// 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 Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System.IO; diff --git a/src/Wpf.Ui.Extension.Template.Compact/AssemblyInfo.cs b/src/Wpf.Ui.Extension.Template.Compact/AssemblyInfo.cs index 688391b05..77c6c5db5 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/AssemblyInfo.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/AssemblyInfo.cs @@ -1,8 +1,3 @@ -// 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; [assembly: ThemeInfo( diff --git a/src/Wpf.Ui.Extension.Template.Compact/Helpers/EnumToBooleanConverter.cs b/src/Wpf.Ui.Extension.Template.Compact/Helpers/EnumToBooleanConverter.cs index 161e72f8f..6344aa57e 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Helpers/EnumToBooleanConverter.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Helpers/EnumToBooleanConverter.cs @@ -1,9 +1,4 @@ -// 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.Globalization; +using System.Globalization; using System.Windows.Data; using Wpf.Ui.Appearance; diff --git a/src/Wpf.Ui.Extension.Template.Compact/Models/AppConfig.cs b/src/Wpf.Ui.Extension.Template.Compact/Models/AppConfig.cs index 344606637..de05a5c07 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Models/AppConfig.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Models/AppConfig.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.Models +namespace $safeprojectname$.Models { public class AppConfig { diff --git a/src/Wpf.Ui.Extension.Template.Compact/Models/DataColor.cs b/src/Wpf.Ui.Extension.Template.Compact/Models/DataColor.cs index 2b7ef8630..37d424944 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Models/DataColor.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Models/DataColor.cs @@ -1,9 +1,4 @@ -// 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.Media; +using System.Windows.Media; namespace $safeprojectname$.Models { diff --git a/src/Wpf.Ui.Extension.Template.Compact/Resources/Translations.cs b/src/Wpf.Ui.Extension.Template.Compact/Resources/Translations.cs index 1c995913c..67442adcd 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Resources/Translations.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Resources/Translations.cs @@ -1,8 +1,3 @@ -// 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 $safeprojectname$.Resources { public partial class Translations diff --git a/src/Wpf.Ui.Extension.Template.Compact/Services/ApplicationHostService.cs b/src/Wpf.Ui.Extension.Template.Compact/Services/ApplicationHostService.cs index 47eaadf37..6498f6603 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Services/ApplicationHostService.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Services/ApplicationHostService.cs @@ -1,9 +1,4 @@ -// 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 Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Wpf.Ui; using $safeprojectname$.Views.Pages; diff --git a/src/Wpf.Ui.Extension.Template.Compact/Services/PageService.cs b/src/Wpf.Ui.Extension.Template.Compact/Services/PageService.cs index d63a62426..2578f166d 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Services/PageService.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Services/PageService.cs @@ -1,8 +1,3 @@ -// 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 Wpf.Ui; namespace $safeprojectname$.Services diff --git a/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/DashboardViewModel.cs b/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/DashboardViewModel.cs index 3248e59fe..f6987841c 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/DashboardViewModel.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/DashboardViewModel.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Pages +namespace $safeprojectname$.ViewModels.Pages { public partial class DashboardViewModel : ObservableObject { diff --git a/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/DataViewModel.cs b/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/DataViewModel.cs index 2e45b7751..449dcf9c7 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/DataViewModel.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/DataViewModel.cs @@ -1,9 +1,4 @@ -// 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.Media; +using System.Windows.Media; using $safeprojectname$.Models; using Wpf.Ui.Controls; diff --git a/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/SettingsViewModel.cs b/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/SettingsViewModel.cs index b3c7e1595..2d0224df3 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/SettingsViewModel.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Pages/SettingsViewModel.cs @@ -1,9 +1,4 @@ -// 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 Wpf.Ui.Appearance; +using Wpf.Ui.Appearance; using Wpf.Ui.Controls; namespace $safeprojectname$.ViewModels.Pages diff --git a/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Windows/MainWindowViewModel.cs b/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Windows/MainWindowViewModel.cs index be9f0e387..dc7039ccb 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Windows/MainWindowViewModel.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/ViewModels/Windows/MainWindowViewModel.cs @@ -1,9 +1,4 @@ -// 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.Collections.ObjectModel; +using System.Collections.ObjectModel; using Wpf.Ui.Controls; namespace $safeprojectname$.ViewModels.Windows diff --git a/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/DashboardPage.xaml.cs b/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/DashboardPage.xaml.cs index 50497f425..288b6feeb 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/DashboardPage.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/DashboardPage.xaml.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Pages; +using $safeprojectname$.ViewModels.Pages; using Wpf.Ui.Controls; namespace $safeprojectname$.Views.Pages diff --git a/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/DataPage.xaml.cs b/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/DataPage.xaml.cs index 7dfee97b0..5c0fa3e89 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/DataPage.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/DataPage.xaml.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Pages; +using $safeprojectname$.ViewModels.Pages; using Wpf.Ui.Controls; namespace $safeprojectname$.Views.Pages diff --git a/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/SettingsPage.xaml.cs b/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/SettingsPage.xaml.cs index eb2d9f4e4..c3decb5af 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/SettingsPage.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Views/Pages/SettingsPage.xaml.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Pages; +using $safeprojectname$.ViewModels.Pages; using Wpf.Ui.Controls; namespace $safeprojectname$.Views.Pages diff --git a/src/Wpf.Ui.Extension.Template.Compact/Views/Windows/MainWindow.xaml.cs b/src/Wpf.Ui.Extension.Template.Compact/Views/Windows/MainWindow.xaml.cs index b2af8c0e2..5e09543d8 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Views/Windows/MainWindow.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Compact/Views/Windows/MainWindow.xaml.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Windows; +using $safeprojectname$.ViewModels.Windows; using Wpf.Ui; using Wpf.Ui.Appearance; using Wpf.Ui.Controls; diff --git a/src/Wpf.Ui.Extension.Template.Compact/Wpf.Ui.Compact.csproj b/src/Wpf.Ui.Extension.Template.Compact/Wpf.Ui.Compact.csproj index 374f7bdb3..1eeee3598 100644 --- a/src/Wpf.Ui.Extension.Template.Compact/Wpf.Ui.Compact.csproj +++ b/src/Wpf.Ui.Extension.Template.Compact/Wpf.Ui.Compact.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Wpf.Ui.Extension.Template.Fluent/App.xaml.cs b/src/Wpf.Ui.Extension.Template.Fluent/App.xaml.cs index dd6c6fb95..bcedf63e4 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/App.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/App.xaml.cs @@ -1,9 +1,4 @@ -// 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 Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System.IO; diff --git a/src/Wpf.Ui.Extension.Template.Fluent/AssemblyInfo.cs b/src/Wpf.Ui.Extension.Template.Fluent/AssemblyInfo.cs index 688391b05..77c6c5db5 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/AssemblyInfo.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/AssemblyInfo.cs @@ -1,8 +1,3 @@ -// 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; [assembly: ThemeInfo( diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Helpers/EnumToBooleanConverter.cs b/src/Wpf.Ui.Extension.Template.Fluent/Helpers/EnumToBooleanConverter.cs index 161e72f8f..6344aa57e 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Helpers/EnumToBooleanConverter.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Helpers/EnumToBooleanConverter.cs @@ -1,9 +1,4 @@ -// 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.Globalization; +using System.Globalization; using System.Windows.Data; using Wpf.Ui.Appearance; diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Models/AppConfig.cs b/src/Wpf.Ui.Extension.Template.Fluent/Models/AppConfig.cs index 344606637..de05a5c07 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Models/AppConfig.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Models/AppConfig.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.Models +namespace $safeprojectname$.Models { public class AppConfig { diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Models/DataColor.cs b/src/Wpf.Ui.Extension.Template.Fluent/Models/DataColor.cs index 2b7ef8630..37d424944 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Models/DataColor.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Models/DataColor.cs @@ -1,9 +1,4 @@ -// 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.Media; +using System.Windows.Media; namespace $safeprojectname$.Models { diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Resources/Translations.cs b/src/Wpf.Ui.Extension.Template.Fluent/Resources/Translations.cs index 1c995913c..67442adcd 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Resources/Translations.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Resources/Translations.cs @@ -1,8 +1,3 @@ -// 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 $safeprojectname$.Resources { public partial class Translations diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Services/ApplicationHostService.cs b/src/Wpf.Ui.Extension.Template.Fluent/Services/ApplicationHostService.cs index 47eaadf37..6498f6603 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Services/ApplicationHostService.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Services/ApplicationHostService.cs @@ -1,9 +1,4 @@ -// 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 Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Wpf.Ui; using $safeprojectname$.Views.Pages; diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Services/PageService.cs b/src/Wpf.Ui.Extension.Template.Fluent/Services/PageService.cs index d63a62426..2578f166d 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Services/PageService.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Services/PageService.cs @@ -1,8 +1,3 @@ -// 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 Wpf.Ui; namespace $safeprojectname$.Services diff --git a/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/DashboardViewModel.cs b/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/DashboardViewModel.cs index 3248e59fe..f6987841c 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/DashboardViewModel.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/DashboardViewModel.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Pages +namespace $safeprojectname$.ViewModels.Pages { public partial class DashboardViewModel : ObservableObject { diff --git a/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/DataViewModel.cs b/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/DataViewModel.cs index 2e45b7751..449dcf9c7 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/DataViewModel.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/DataViewModel.cs @@ -1,9 +1,4 @@ -// 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.Media; +using System.Windows.Media; using $safeprojectname$.Models; using Wpf.Ui.Controls; diff --git a/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/SettingsViewModel.cs b/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/SettingsViewModel.cs index b3c7e1595..2d0224df3 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/SettingsViewModel.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Pages/SettingsViewModel.cs @@ -1,9 +1,4 @@ -// 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 Wpf.Ui.Appearance; +using Wpf.Ui.Appearance; using Wpf.Ui.Controls; namespace $safeprojectname$.ViewModels.Pages diff --git a/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Windows/MainWindowViewModel.cs b/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Windows/MainWindowViewModel.cs index be9f0e387..dc7039ccb 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Windows/MainWindowViewModel.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/ViewModels/Windows/MainWindowViewModel.cs @@ -1,9 +1,4 @@ -// 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.Collections.ObjectModel; +using System.Collections.ObjectModel; using Wpf.Ui.Controls; namespace $safeprojectname$.ViewModels.Windows diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/DashboardPage.xaml.cs b/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/DashboardPage.xaml.cs index 50497f425..288b6feeb 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/DashboardPage.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/DashboardPage.xaml.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Pages; +using $safeprojectname$.ViewModels.Pages; using Wpf.Ui.Controls; namespace $safeprojectname$.Views.Pages diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/DataPage.xaml.cs b/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/DataPage.xaml.cs index 7dfee97b0..5c0fa3e89 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/DataPage.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/DataPage.xaml.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Pages; +using $safeprojectname$.ViewModels.Pages; using Wpf.Ui.Controls; namespace $safeprojectname$.Views.Pages diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/SettingsPage.xaml.cs b/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/SettingsPage.xaml.cs index eb2d9f4e4..c3decb5af 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/SettingsPage.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Views/Pages/SettingsPage.xaml.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Pages; +using $safeprojectname$.ViewModels.Pages; using Wpf.Ui.Controls; namespace $safeprojectname$.Views.Pages diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Views/Windows/MainWindow.xaml.cs b/src/Wpf.Ui.Extension.Template.Fluent/Views/Windows/MainWindow.xaml.cs index b2af8c0e2..5e09543d8 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Views/Windows/MainWindow.xaml.cs +++ b/src/Wpf.Ui.Extension.Template.Fluent/Views/Windows/MainWindow.xaml.cs @@ -1,9 +1,4 @@ -// 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 $safeprojectname$.ViewModels.Windows; +using $safeprojectname$.ViewModels.Windows; using Wpf.Ui; using Wpf.Ui.Appearance; using Wpf.Ui.Controls; diff --git a/src/Wpf.Ui.Extension.Template.Fluent/Wpf.Ui.Fluent.csproj b/src/Wpf.Ui.Extension.Template.Fluent/Wpf.Ui.Fluent.csproj index feafab48f..833c8384d 100644 --- a/src/Wpf.Ui.Extension.Template.Fluent/Wpf.Ui.Fluent.csproj +++ b/src/Wpf.Ui.Extension.Template.Fluent/Wpf.Ui.Fluent.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Wpf.Ui.Extension/source.extension.vsixmanifest b/src/Wpf.Ui.Extension/source.extension.vsixmanifest index bed72a96b..b1a287dd1 100644 --- a/src/Wpf.Ui.Extension/source.extension.vsixmanifest +++ b/src/Wpf.Ui.Extension/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + WPF UI WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. https://github.com/lepoco/wpfui diff --git a/src/Wpf.Ui.Gallery.Package/Wpf.Ui.Gallery.Package.wapproj b/src/Wpf.Ui.Gallery.Package/Wpf.Ui.Gallery.Package.wapproj index 2c3434ed2..aa72c787b 100644 --- a/src/Wpf.Ui.Gallery.Package/Wpf.Ui.Gallery.Package.wapproj +++ b/src/Wpf.Ui.Gallery.Package/Wpf.Ui.Gallery.Package.wapproj @@ -55,7 +55,7 @@ 10.0.14393.0 en-US false - $(NoWarn);NU1702 + $(NoWarn);NU1701;NU1702 ..\Wpf.Ui.Gallery\Wpf.Ui.Gallery.csproj True False diff --git a/src/Wpf.Ui.Gallery/ViewModels/Windows/EditorWindowViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Windows/EditorWindowViewModel.cs index 97c42d856..c7051b616 100644 --- a/src/Wpf.Ui.Gallery/ViewModels/Windows/EditorWindowViewModel.cs +++ b/src/Wpf.Ui.Gallery/ViewModels/Windows/EditorWindowViewModel.cs @@ -17,7 +17,7 @@ public partial class EditorWindowViewModel : ObservableObject private int _progress = 70; [ObservableProperty] - private string _currentlyOpenedFile = String.Empty; + private string _currentlyOpenedFile = string.Empty; [ObservableProperty] private Visibility _statusBarVisibility = Visibility.Visible; @@ -25,9 +25,9 @@ public partial class EditorWindowViewModel : ObservableObject [RelayCommand] public void OnStatusBarAction(string value) { - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) + { return; - - switch (value) { } + } } } diff --git a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs index 43531e71d..e45879a95 100644 --- a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs +++ b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs @@ -35,7 +35,7 @@ public partial class MainWindowViewModel : ObservableObject { Content = "Design guidance", Icon = new SymbolIcon { Symbol = SymbolRegular.DesignIdeas24 }, - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem("Typography", SymbolRegular.TextFont24, typeof(TypographyPage)), new NavigationViewItem("Icons", SymbolRegular.Diversity24, typeof(IconsPage)), @@ -46,7 +46,7 @@ public partial class MainWindowViewModel : ObservableObject new NavigationViewItemSeparator(), new NavigationViewItem("Basic Input", SymbolRegular.CheckboxChecked24, typeof(BasicInputPage)) { - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem(nameof(Anchor), typeof(AnchorPage)), new NavigationViewItem(nameof(Wpf.Ui.Controls.Button), typeof(ButtonPage)), @@ -68,7 +68,7 @@ public partial class MainWindowViewModel : ObservableObject Content = "Collections", Icon = new SymbolIcon { Symbol = SymbolRegular.Table24 }, TargetPageType = typeof(CollectionsPage), - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem(nameof(System.Windows.Controls.DataGrid), typeof(DataGridPage)), new NavigationViewItem(nameof(ListBox), typeof(ListBoxPage)), @@ -81,7 +81,7 @@ public partial class MainWindowViewModel : ObservableObject }, new NavigationViewItem("Date & time", SymbolRegular.CalendarClock24, typeof(DateAndTimePage)) { - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem(nameof(CalendarDatePicker), typeof(CalendarDatePickerPage)), new NavigationViewItem(nameof(System.Windows.Controls.Calendar), typeof(CalendarPage)), @@ -91,7 +91,7 @@ public partial class MainWindowViewModel : ObservableObject }, new NavigationViewItem("Dialogs & flyouts", SymbolRegular.Chat24, typeof(DialogsAndFlyoutsPage)) { - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem(nameof(Snackbar), typeof(SnackbarPage)), new NavigationViewItem(nameof(ContentDialog), typeof(ContentDialogPage)), @@ -102,7 +102,7 @@ public partial class MainWindowViewModel : ObservableObject #if DEBUG new NavigationViewItem("Layout", SymbolRegular.News24, typeof(LayoutPage)) { - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem("Expander", typeof(ExpanderPage)), new NavigationViewItem("CardControl", typeof(CardControlPage)), @@ -115,7 +115,7 @@ public partial class MainWindowViewModel : ObservableObject Content = "Media", Icon = new SymbolIcon { Symbol = SymbolRegular.PlayCircle24 }, TargetPageType = typeof(MediaPage), - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem("Image", typeof(ImagePage)), new NavigationViewItem("Canvas", typeof(CanvasPage)), @@ -125,7 +125,7 @@ public partial class MainWindowViewModel : ObservableObject }, new NavigationViewItem("Navigation", SymbolRegular.Navigation24, typeof(NavigationPage)) { - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem("BreadcrumbBar", typeof(BreadcrumbBarPage)), new NavigationViewItem("NavigationView", typeof(NavigationViewPage)), @@ -140,7 +140,7 @@ public partial class MainWindowViewModel : ObservableObject typeof(StatusAndInfoPage) ) { - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem("InfoBadge", typeof(InfoBadgePage)), new NavigationViewItem("InfoBar", typeof(InfoBarPage)), @@ -151,7 +151,7 @@ public partial class MainWindowViewModel : ObservableObject }, new NavigationViewItem("Text", SymbolRegular.DrawText24, typeof(TextPage)) { - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem(nameof(AutoSuggestBox), typeof(AutoSuggestBoxPage)), new NavigationViewItem(nameof(NumberBox), typeof(NumberBoxPage)), @@ -164,7 +164,7 @@ public partial class MainWindowViewModel : ObservableObject }, new NavigationViewItem("System", SymbolRegular.Desktop24, typeof(OpSystemPage)) { - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem("Clipboard", typeof(ClipboardPage)), new NavigationViewItem("FilePicker", typeof(FilePickerPage)), diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml index 35cdf639c..e03078edc 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml +++ b/src/Wpf.Ui.Gallery/Views/Pages/Collections/ListViewPage.xaml @@ -121,31 +121,34 @@ <ListView ItemsSource="{Binding ViewModel.BasicListViewItems}">\n \t<ListView.View>\n - \t\t<GridView>\n - \t\t\t<GridViewColumn DisplayMemberBinding="{Binding FirstName}" Header="First Name"/>\n + \t\t<ui:GridView>\n + \t\t\t<GridViewColumn DisplayMemberBinding="{Binding FirstName}" Header="First Name" MinWidth=&quot;100&quot; MaxWidth=&quot;200&quot;/>\n \t\t\t<GridViewColumn DisplayMemberBinding="{Binding LastName}" Header="Last Name"/>\n \t\t\t<GridViewColumn DisplayMemberBinding="{Binding Company}" Header="Company"/>\n - \t\t</GridView>\n + \t\t</ui:GridView>\n \t</ListView.View>\n </ListView> - - + - - - + + diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Layout/CardControlPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/Layout/CardControlPage.xaml.cs index 3b9a29a10..be114d103 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/Layout/CardControlPage.xaml.cs +++ b/src/Wpf.Ui.Gallery/Views/Pages/Layout/CardControlPage.xaml.cs @@ -3,20 +3,6 @@ // Copyright (C) Leszek Pomianowski and WPF UI Contributors. // All Rights Reserved. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using Wpf.Ui.Controls; using Wpf.Ui.Gallery.ControlsLookup; using Wpf.Ui.Gallery.ViewModels.Pages.Layout; @@ -26,7 +12,7 @@ namespace Wpf.Ui.Gallery.Views.Pages.Layout; /// /// Interaction logic for CardControlPage.xaml /// -[GalleryPage("Card control.", SymbolRegular.CardUi24)] +[GalleryPage("Card control.", SymbolRegular.CheckboxIndeterminate24)] public partial class CardControlPage : INavigableView { public CardControlPage(CardControlViewModel viewModel) diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationViewPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationViewPage.xaml index 2b1d18110..a772a3279 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationViewPage.xaml +++ b/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationViewPage.xaml @@ -197,7 +197,12 @@ + TargetPageType="{x:Type samples:SamplePage1}"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Wpf.Ui.Gallery/Views/Windows/SandboxWindow.xaml.cs b/src/Wpf.Ui.Gallery/Views/Windows/SandboxWindow.xaml.cs index f84f00a02..9200ac630 100644 --- a/src/Wpf.Ui.Gallery/Views/Windows/SandboxWindow.xaml.cs +++ b/src/Wpf.Ui.Gallery/Views/Windows/SandboxWindow.xaml.cs @@ -22,7 +22,7 @@ public SandboxWindow(SandboxWindowViewModel viewModel) MyTestNavigationView.Loaded += (sender, args) => { - MyTestNavigationView.MenuItems = new ObservableCollection() + MyTestNavigationView.MenuItemsSource = new ObservableCollection() { new NavigationViewItem("Home", SymbolRegular.Home24, typeof(SamplePage1)) }; diff --git a/src/Wpf.Ui.Gallery/Wpf.Ui.Gallery.csproj b/src/Wpf.Ui.Gallery/Wpf.Ui.Gallery.csproj index b8e46f8ab..24c428ff6 100644 --- a/src/Wpf.Ui.Gallery/Wpf.Ui.Gallery.csproj +++ b/src/Wpf.Ui.Gallery/Wpf.Ui.Gallery.csproj @@ -11,6 +11,7 @@ Wpf.Ui.Gallery AnyCPU;x64;x86 10.0.18362.0 + $(NoWarn);SA1601 diff --git a/src/Wpf.Ui.ToastNotifications/Toast.cs b/src/Wpf.Ui.ToastNotifications/Toast.cs index fdf662bc1..c90fc816c 100644 --- a/src/Wpf.Ui.ToastNotifications/Toast.cs +++ b/src/Wpf.Ui.ToastNotifications/Toast.cs @@ -7,8 +7,14 @@ namespace Wpf.Ui.ToastNotifications; +/// +/// Represents a toast notification. +/// public class Toast { + /// + /// Displays the toast notification. + /// public void Show() { // TODO: Implement native Toast without external libraries diff --git a/src/Wpf.Ui.Tray/Interop/User32.cs b/src/Wpf.Ui.Tray/Interop/User32.cs index d64b4a7c0..86397e655 100644 --- a/src/Wpf.Ui.Tray/Interop/User32.cs +++ b/src/Wpf.Ui.Tray/Interop/User32.cs @@ -15,6 +15,9 @@ namespace Wpf.Ui.Tray.Interop; /// // ReSharper disable IdentifierTypo // ReSharper disable InconsistentNaming +#pragma warning disable SA1300 // Element should begin with upper-case letter +#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter +#pragma warning disable SA1401 // Fields should be private internal static class User32 { /// @@ -632,8 +635,8 @@ public enum WS_EX : long LAYOUTRTL = 0x00400000, // Right to left mirroring COMPOSITED = 0x02000000, NOACTIVATE = 0x08000000, - OVERLAPPEDWINDOW = (WINDOWEDGE | CLIENTEDGE), - PALETTEWINDOW = (WINDOWEDGE | TOOLWINDOW | TOPMOST), + OVERLAPPEDWINDOW = WINDOWEDGE | CLIENTEDGE, + PALETTEWINDOW = WINDOWEDGE | TOOLWINDOW | TOPMOST, } /// @@ -867,7 +870,7 @@ public struct WNDCLASSEX /// /// The message to add to or remove from the filter. /// The action to be performed. One of the following values. - /// if successful; otherwise, . To get extended error information, call . + /// if successful; otherwise, . To get extended error information, call Kernel32.GetLastError(). [DllImport(Libraries.User32, CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool ChangeWindowMessageFilter([In] WM message, [In] MSGFLT dwFlag); @@ -879,7 +882,7 @@ public struct WNDCLASSEX /// The message that the message filter allows through or blocks. /// The action to be performed. /// Optional pointer to a structure. - /// If the function succeeds, it returns ; otherwise, it returns . To get extended error information, call . + /// If the function succeeds, it returns ; otherwise, it returns . To get extended error information, call Kernel32.GetLastError(). [DllImport(Libraries.User32, CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool ChangeWindowMessageFilterEx( @@ -1025,7 +1028,7 @@ public struct WNDCLASSEX [In, Optional] IntPtr lpParam ) { - IntPtr ret = CreateWindowExW( + var ret = CreateWindowExW( dwExStyle, lpClassName, lpWindowName, @@ -1039,10 +1042,11 @@ public struct WNDCLASSEX hInstance, lpParam ); - if (IntPtr.Zero == ret) + + if (ret == IntPtr.Zero) { - throw new Exception("Unable to create a window"); // HRESULT.ThrowLastError(); + throw new Exception("Unable to create a window"); } return ret; @@ -1130,7 +1134,7 @@ public struct WNDCLASSEX /// /// Retrieves information about the specified window. The function also retrieves the 32-bit (DWORD) value at the specified offset into the extra window memory. /// If you are retrieving a pointer or a handle, this function has been superseded by the function. - /// Unicode declaration for + /// Unicode declaration for /// /// A handle to the window and, indirectly, the class to which the window belongs. /// The zero-based offset to the value to be retrieved. @@ -1141,7 +1145,7 @@ public struct WNDCLASSEX /// /// Retrieves information about the specified window. The function also retrieves the 32-bit (DWORD) value at the specified offset into the extra window memory. /// If you are retrieving a pointer or a handle, this function has been superseded by the function. - /// ANSI declaration for + /// ANSI declaration for /// /// A handle to the window and, indirectly, the class to which the window belongs. /// The zero-based offset to the value to be retrieved. @@ -1407,36 +1411,15 @@ public struct WNDCLASSEX [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetForegroundWindow(IntPtr hWnd); - /// - /// - /// - /// [DllImport(Libraries.User32)] public static extern IntPtr GetShellWindow(); - /// - /// - /// - /// - /// - /// [DllImport(Libraries.User32, CharSet = CharSet.Unicode)] public static extern int MapVirtualKey(int nVirtKey, int nMapType); - /// - /// - /// - /// - /// [DllImport(Libraries.User32)] public static extern int GetSysColor(int nIndex); - /// - /// - /// - /// - /// - /// [DllImport(Libraries.User32)] public static extern IntPtr GetSystemMenu( [In] IntPtr hWnd, @@ -1456,7 +1439,7 @@ public struct WNDCLASSEX public static MF EnableMenuItem([In] IntPtr hMenu, [In] SC uIDEnableItem, [In] MF uEnable) { // Returns the previous state of the menu item, or -1 if the menu item does not exist. - int iRet = _EnableMenuItem(hMenu, uIDEnableItem, uEnable); + var iRet = _EnableMenuItem(hMenu, uIDEnableItem, uEnable); return (MF)iRet; } @@ -1476,9 +1459,9 @@ public static MF EnableMenuItem([In] IntPtr hMenu, [In] SC uIDEnableItem, [In] M /// Native method returned HRESULT. public static void SetWindowRgn([In] IntPtr hWnd, [In] IntPtr hRgn, [In] bool bRedraw) { - int err = _SetWindowRgn(hWnd, hRgn, bRedraw); + var err = _SetWindowRgn(hWnd, hRgn, bRedraw); - if (0 == err) + if (err == 0) { throw new Win32Exception(); } @@ -1566,3 +1549,6 @@ public static void SetWindowRgn([In] IntPtr hWnd, [In] IntPtr hRgn, [In] bool bR [DllImport(Libraries.User32, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)] public static extern uint GetDpiForWindow([In] HandleRef hwnd); } +#pragma warning restore SA1300 // Element should begin with upper-case letter +#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter +#pragma warning restore SA1401 // Fields should be private diff --git a/src/Wpf.Ui/Appearance/ApplicationThemeManager.cs b/src/Wpf.Ui/Appearance/ApplicationThemeManager.cs index b96e2cbbb..539c5210d 100644 --- a/src/Wpf.Ui/Appearance/ApplicationThemeManager.cs +++ b/src/Wpf.Ui/Appearance/ApplicationThemeManager.cs @@ -3,7 +3,6 @@ // Copyright (C) Leszek Pomianowski and WPF UI Contributors. // All Rights Reserved. -using System.Runtime.CompilerServices; using Wpf.Ui.Controls; namespace Wpf.Ui.Appearance; @@ -115,31 +114,11 @@ public static class ApplicationThemeManager break; } - var isUpdated = appDictionaries.UpdateDictionary( + bool isUpdated = appDictionaries.UpdateDictionary( "theme", new Uri(ThemesDictionaryPath + themeDictionaryName + ".xaml", UriKind.Absolute) ); - //var wpfUiDictionary = appDictionaries.GetDictionary("wpf.ui"); - - // Force reloading ALL dictionaries - // Works but is terrible - //var isCoreUpdated = appDictionaries.UpdateDictionary( - // "wpf.ui", - // new Uri( - // AppearanceData.LibraryDictionariesUri + "Wpf.Ui.xaml", - // UriKind.Absolute - // ) - //); - - //var isBrushesUpdated = appDictionaries.UpdateDictionary( - // "assets/brushes", - // new Uri( - // AppearanceData.LibraryDictionariesUri + "Assets/Brushes.xaml", - // UriKind.Absolute - // ) - // ); - #if DEBUG System.Diagnostics.Debug.WriteLine( $"INFO | {typeof(ApplicationThemeManager)} tries to update theme to {themeDictionaryName} ({applicationTheme}): {isUpdated}", @@ -174,14 +153,16 @@ public static class ApplicationThemeManager public static void Apply(FrameworkElement frameworkElement) { if (frameworkElement is null) + { return; + } - var resourcesRemove = frameworkElement + ResourceDictionary[] resourcesRemove = frameworkElement .Resources.MergedDictionaries.Where(e => e.Source is not null) .Where(e => e.Source.ToString().ToLower().Contains(LibraryNamespace)) .ToArray(); - foreach (var resource in UiApplication.Current.Resources.MergedDictionaries) + foreach (ResourceDictionary? resource in UiApplication.Current.Resources.MergedDictionaries) { System.Diagnostics.Debug.WriteLine( $"INFO | {typeof(ApplicationThemeManager)} Add {resource.Source}", @@ -190,13 +171,14 @@ public static void Apply(FrameworkElement frameworkElement) frameworkElement.Resources.MergedDictionaries.Add(resource); } - foreach (var resource in resourcesRemove) + foreach (ResourceDictionary resource in resourcesRemove) { System.Diagnostics.Debug.WriteLine( $"INFO | {typeof(ApplicationThemeManager)} Remove {resource.Source}", "Wpf.Ui.Appearance" ); - frameworkElement.Resources.MergedDictionaries.Remove(resource); + + _ = frameworkElement.Resources.MergedDictionaries.Remove(resource); } foreach (System.Collections.DictionaryEntry resource in UiApplication.Current.Resources) @@ -323,7 +305,7 @@ private static void FetchApplicationTheme() return; } - var themeUri = themeDictionary.Source.ToString().Trim().ToLower(); + string themeUri = themeDictionary.Source.ToString().Trim().ToLower(); if (themeUri.Contains("light")) { diff --git a/src/Wpf.Ui/Appearance/WindowBackgroundManager.cs b/src/Wpf.Ui/Appearance/WindowBackgroundManager.cs index ca68aa03a..5b573f818 100644 --- a/src/Wpf.Ui/Appearance/WindowBackgroundManager.cs +++ b/src/Wpf.Ui/Appearance/WindowBackgroundManager.cs @@ -96,7 +96,7 @@ bool forceBackground RemoveDarkThemeFromWindow(window); } - foreach (var subWindow in window.OwnedWindows) + foreach (object? subWindow in window.OwnedWindows) { if (subWindow is Window windowSubWindow) { @@ -112,50 +112,5 @@ bool forceBackground } } } - - // Do we really neeed this? - //if (!Win32.Utilities.IsOSWindows11OrNewer) - //{ - // var mainWindow = UiApplication.Current.MainWindow; - - // if (mainWindow == null) - // return; - - // var backgroundColor = UiApplication.Current.Resources["ApplicationBackgroundColor"]; - // if (backgroundColor is Color color) - // mainWindow.Background = new SolidColorBrush(color); - //} - - - // var mainWindow = UiApplication.Current.MainWindow; - - // if (mainWindow == null) - // return; - - // // TODO: Do not refresh window presenter background if already applied - // var backgroundColor = UiApplication.Current.Resources["ApplicationBackgroundColor"]; - // if (backgroundColor is Color color) - // mainWindow.Background = new SolidColorBrush(color); - - //#if DEBUG - // System.Diagnostics.Debug.WriteLine($"INFO | Current background color: {backgroundColor}", "Wpf.Ui.Theme"); - //#endif - - // var windowHandle = new WindowInteropHelper(mainWindow).Handle; - - // if (windowHandle == IntPtr.Zero) - // return; - - // Background.Remove(windowHandle); - - // //if (!IsAppMatchesSystem() || backgroundEffect == BackgroundType.Unknown) - // // return; - - // if (backgroundEffect == BackgroundType.Unknown) - // return; - - // // TODO: Improve - // if (Background.Apply(windowHandle, backgroundEffect, forceBackground)) - // mainWindow.Background = Brushes.Transparent; } } diff --git a/src/Wpf.Ui/Controls/AccessText/AccessText.xaml b/src/Wpf.Ui/Controls/AccessText/AccessText.xaml new file mode 100644 index 000000000..3e8dde99c --- /dev/null +++ b/src/Wpf.Ui/Controls/AccessText/AccessText.xaml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Wpf.Ui/Controls/GridView/GridViewHeaderRowIndicator.xaml b/src/Wpf.Ui/Controls/GridView/GridViewHeaderRowIndicator.xaml new file mode 100644 index 000000000..77537437e --- /dev/null +++ b/src/Wpf.Ui/Controls/GridView/GridViewHeaderRowIndicator.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/Wpf.Ui/Controls/GridView/GridViewHeaderRowPresenter.cs b/src/Wpf.Ui/Controls/GridView/GridViewHeaderRowPresenter.cs new file mode 100644 index 000000000..2e99fad90 --- /dev/null +++ b/src/Wpf.Ui/Controls/GridView/GridViewHeaderRowPresenter.cs @@ -0,0 +1,91 @@ +// 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.Diagnostics; +using System.Reflection; +using System.Windows.Controls; + +namespace Wpf.Ui.Controls; + +/// +/// Extends , and adds layout support for , which can have and . +/// +public class GridViewHeaderRowPresenter : System.Windows.Controls.GridViewHeaderRowPresenter +{ + public GridViewHeaderRowPresenter() + { + Loaded += OnLoaded; + } + + protected override Size ArrangeOverride(Size arrangeSize) + { + // update the desired width of each column (clamps desiredwidth to MinWidth and MaxWidth) + if (Columns != null) + { + foreach (GridViewColumn column in Columns.OfType()) + { + column.UpdateDesiredWidth(); + } + } + + return base.ArrangeOverride(arrangeSize); + } + + protected override Size MeasureOverride(Size constraint) + { + if (Columns != null) + { + foreach (GridViewColumn column in Columns.OfType()) + { + column.UpdateDesiredWidth(); + } + } + + return base.MeasureOverride(constraint); + } + + private void OnLoaded(object sender, RoutedEventArgs e) + { + UpdateIndicatorStyle(); + } + + private void UpdateIndicatorStyle() + { + FieldInfo? indicatorField = typeof(System.Windows.Controls.GridViewHeaderRowPresenter).GetField( + "_indicator", + BindingFlags.NonPublic | BindingFlags.Instance + ); + + if (indicatorField == null) + { + Debug.WriteLine("Failed to get the _indicator field"); + return; + } + + if (indicatorField.GetValue(this) is Separator indicator) + { + indicator.Margin = new Thickness(0); + indicator.Width = 3.0; + + ResourceDictionary resourceDictionary = + new() + { + Source = new Uri( + "pack://application:,,,/Wpf.Ui;component/Controls/GridView/GridViewHeaderRowIndicator.xaml", + UriKind.Absolute + ) + }; + + if (resourceDictionary["GridViewHeaderRowIndicatorTemplate"] is ControlTemplate template) + { + indicator.Template = template; + } + else + { + Debug.WriteLine("Failed to get the GridViewHeaderRowIndicatorTemplate"); + } + } + } +} diff --git a/src/Wpf.Ui/Controls/GridView/GridViewRowPresenter.cs b/src/Wpf.Ui/Controls/GridView/GridViewRowPresenter.cs new file mode 100644 index 000000000..0ba3e9334 --- /dev/null +++ b/src/Wpf.Ui/Controls/GridView/GridViewRowPresenter.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Windows.Controls; + +namespace Wpf.Ui.Controls; + +/// +/// Extends , and adds header row layout support for , which can have and . +/// +public class GridViewRowPresenter : System.Windows.Controls.GridViewRowPresenter +{ + protected override Size ArrangeOverride(Size arrangeSize) + { + // update the desired width of each column (clamps desiredwidth to MinWidth and MaxWidth) + if (Columns != null) + { + foreach (GridViewColumn column in Columns.OfType()) + { + column.UpdateDesiredWidth(); + } + } + + return base.ArrangeOverride(arrangeSize); + } + + protected override Size MeasureOverride(Size constraint) + { + if (Columns != null) + { + foreach (GridViewColumn column in Columns.OfType()) + { + column.UpdateDesiredWidth(); + } + } + + return base.MeasureOverride(constraint); + } +} diff --git a/src/Wpf.Ui/Controls/IconElement/FontIcon.cs b/src/Wpf.Ui/Controls/IconElement/FontIcon.cs index 4336df477..bc3e7ee3c 100644 --- a/src/Wpf.Ui/Controls/IconElement/FontIcon.cs +++ b/src/Wpf.Ui/Controls/IconElement/FontIcon.cs @@ -15,8 +15,8 @@ namespace Wpf.Ui.Controls; /// /// Represents an icon that uses a glyph from the specified font. /// -//[ToolboxItem(true)] -//[ToolboxBitmap(typeof(FontIcon), "FontIcon.bmp")] +// [ToolboxItem(true)] +// [ToolboxBitmap(typeof(FontIcon), "FontIcon.bmp")] public class FontIcon : IconElement { #region Static properties diff --git a/src/Wpf.Ui/Controls/IconElement/IconElement.cs b/src/Wpf.Ui/Controls/IconElement/IconElement.cs index 1f97a7d4b..978d703f5 100644 --- a/src/Wpf.Ui/Controls/IconElement/IconElement.cs +++ b/src/Wpf.Ui/Controls/IconElement/IconElement.cs @@ -49,31 +49,30 @@ public Brush Foreground private Grid? _layoutRoot; - #region Protected methods - protected abstract UIElement InitializeChildren(); protected virtual void OnForegroundPropertyChanged(DependencyPropertyChangedEventArgs args) { } - #endregion - - #region Layout methods - private void EnsureLayoutRoot() { if (_layoutRoot != null) + { return; + } _layoutRoot = new Grid { Background = Brushes.Transparent, SnapsToDevicePixels = true, }; - _layoutRoot.Children.Add(InitializeChildren()); + _ = _layoutRoot.Children.Add(InitializeChildren()); + AddVisualChild(_layoutRoot); } protected override Visual GetVisualChild(int index) { if (index != 0) + { throw new ArgumentOutOfRangeException(nameof(index)); + } EnsureLayoutRoot(); return _layoutRoot!; @@ -94,6 +93,4 @@ protected override Size ArrangeOverride(Size finalSize) _layoutRoot!.Arrange(new Rect(new Point(), finalSize)); return finalSize; } - - #endregion } diff --git a/src/Wpf.Ui/Controls/IconElement/IconSourceElement.cs b/src/Wpf.Ui/Controls/IconElement/IconSourceElement.cs index 425a92c1a..906ef1f19 100644 --- a/src/Wpf.Ui/Controls/IconElement/IconSourceElement.cs +++ b/src/Wpf.Ui/Controls/IconElement/IconSourceElement.cs @@ -30,13 +30,13 @@ public class IconSourceElement : IconElement /// public IconSource? IconSource { - get => (IconSource)GetValue(IconSourceProperty); + get => (IconSource?)GetValue(IconSourceProperty); set => SetValue(IconSourceProperty, value); } protected override UIElement InitializeChildren() { - //TODO come up with an elegant solution + // TODO: Come up with an elegant solution throw new InvalidOperationException($"Use {nameof(IconSourceElementConverter)} class."); } } diff --git a/src/Wpf.Ui/Controls/IconElement/ImageIcon.cs b/src/Wpf.Ui/Controls/IconElement/ImageIcon.cs index d6e0ab9ba..6a2a3968e 100644 --- a/src/Wpf.Ui/Controls/IconElement/ImageIcon.cs +++ b/src/Wpf.Ui/Controls/IconElement/ImageIcon.cs @@ -45,10 +45,13 @@ protected override UIElement InitializeChildren() private static void OnSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var self = (ImageIcon)d; + ImageIcon self = (ImageIcon)d; + if (self.Image is null) + { return; + } - self.Image.Source = (ImageSource)e.NewValue; + self.Image.SetCurrentValue(System.Windows.Controls.Image.SourceProperty, (ImageSource?)e.NewValue); } } diff --git a/src/Wpf.Ui/Controls/Image/Image.cs b/src/Wpf.Ui/Controls/Image/Image.cs index 5f62288fe..d7dc5884e 100644 --- a/src/Wpf.Ui/Controls/Image/Image.cs +++ b/src/Wpf.Ui/Controls/Image/Image.cs @@ -13,9 +13,8 @@ namespace Wpf.Ui.Controls; /// public class Image : Control { - #region DependencyPropreties /// - /// Gets/Sets the Source on this Image. + /// Gets or sets the Source on this Image. /// The Source property is the ImageSource that holds the actual image drawn. /// public static readonly DependencyProperty SourceProperty = DependencyProperty.Register( @@ -86,21 +85,19 @@ public class Image : Control /// public static readonly DependencyProperty InnerCornerRadiusProperty = InnerCornerRadiusPropertyKey.DependencyProperty; - #endregion - #region Propreties /// - /// Gets/Sets the Source on this Image. + /// Gets or sets the Source on this Image. /// The Source property is the ImageSource that holds the actual image drawn. /// - public ImageSource Source + public ImageSource? Source { - get => (ImageSource)GetValue(SourceProperty); + get => (ImageSource?)GetValue(SourceProperty); set => SetValue(SourceProperty, value); } /// - /// Gets/Sets the Stretch on this Image. + /// Gets or sets the Stretch on this Image. /// The Stretch property determines how large the Image will be drawn. /// public Stretch Stretch @@ -110,7 +107,7 @@ public Stretch Stretch } /// - /// Gets/Sets the stretch direction of the Viewbox, which determines the restrictions on + /// Gets or sets the stretch direction of the Viewbox, which determines the restrictions on /// scaling that are applied to the content inside the Viewbox. For instance, this property /// can be used to prevent the content from being smaller than its native size or larger than /// its native size. @@ -122,7 +119,7 @@ public StretchDirection StretchDirection } /// - /// The CornerRadius property allows users to control the roundness of the corners independently by + /// Gets or sets the CornerRadius property allows users to control the roundness of the corners independently by /// setting a radius value for each corner. Radius values that are too large are scaled so that they /// smoothly blend from corner to corner. /// @@ -133,27 +130,24 @@ public CornerRadius CornerRadius } /// - /// The CornerRadius for the inner image's Mask. + /// Gets the CornerRadius for the inner image's Mask. /// internal CornerRadius InnerCornerRadius => (CornerRadius)GetValue(InnerCornerRadiusProperty); - #endregion - #region Methods private static void OnCornerRadiusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var thickness = (Thickness)d.GetValue(BorderThicknessProperty); var outerRarius = (CornerRadius)e.NewValue; - //Inner radius = Outer radius - thickenss/2 + // Inner radius = Outer radius - thickenss/2 d.SetValue( InnerCornerRadiusPropertyKey, new CornerRadius( - topLeft: Math.Max(0, (int)Math.Round(outerRarius.TopLeft - thickness.Left / 2, 0)), - topRight: Math.Max(0, (int)Math.Round(outerRarius.TopRight - thickness.Top / 2, 0)), - bottomRight: Math.Max(0, (int)Math.Round(outerRarius.BottomRight - thickness.Right / 2, 0)), - bottomLeft: Math.Max(0, (int)Math.Round(outerRarius.BottomLeft - thickness.Bottom / 2, 0)) + topLeft: Math.Max(0, (int)Math.Round(outerRarius.TopLeft - (thickness.Left / 2), 0)), + topRight: Math.Max(0, (int)Math.Round(outerRarius.TopRight - (thickness.Top / 2), 0)), + bottomRight: Math.Max(0, (int)Math.Round(outerRarius.BottomRight - (thickness.Right / 2), 0)), + bottomLeft: Math.Max(0, (int)Math.Round(outerRarius.BottomLeft - (thickness.Bottom / 2), 0)) ) ); } - #endregion } diff --git a/src/Wpf.Ui/Controls/ListView/ListView.cs b/src/Wpf.Ui/Controls/ListView/ListView.cs index 8520cd916..31e0237be 100644 --- a/src/Wpf.Ui/Controls/ListView/ListView.cs +++ b/src/Wpf.Ui/Controls/ListView/ListView.cs @@ -7,14 +7,14 @@ namespace Wpf.Ui.Controls; /// /// <ui:ListView ItemsSource="{Binding ...}" > /// <ui:ListView.View> -/// <GridView> +/// <ui:GridView> /// <GridViewColumn /// DisplayMemberBinding="{Binding FirstName}" /// Header="First Name" /> /// <GridViewColumn /// DisplayMemberBinding="{Binding LastName}" /// Header="Last Name" /> -/// </GridView> +/// </ui:GridView> /// </ui:ListView.View> /// </ui:ListView> /// @@ -22,7 +22,12 @@ namespace Wpf.Ui.Controls; public class ListView : System.Windows.Controls.ListView { /// Identifies the dependency property. - public static readonly DependencyProperty ViewStateProperty = DependencyProperty.Register(nameof(ViewState), typeof(ListViewViewState), typeof(ListView), new FrameworkPropertyMetadata(ListViewViewState.Default, OnViewStateChanged)); + public static readonly DependencyProperty ViewStateProperty = DependencyProperty.Register( + nameof(ViewState), + typeof(ListViewViewState), + typeof(ListView), + new FrameworkPropertyMetadata(ListViewViewState.Default, OnViewStateChanged) + ); /// /// Gets or sets the view state of the , enabling custom logic based on the current view. @@ -59,7 +64,10 @@ private void OnLoaded(object sender, RoutedEventArgs e) Loaded -= OnLoaded; // prevent memory leaks // Setup initial ViewState and hook into View property changes - var descriptor = DependencyPropertyDescriptor.FromProperty(System.Windows.Controls.ListView.ViewProperty, typeof(System.Windows.Controls.ListView)); + var descriptor = DependencyPropertyDescriptor.FromProperty( + System.Windows.Controls.ListView.ViewProperty, + typeof(System.Windows.Controls.ListView) + ); descriptor?.AddValueChanged(this, OnViewPropertyChanged); UpdateViewState(); // set the initial state } @@ -83,6 +91,19 @@ private void UpdateViewState() static ListView() { - DefaultStyleKeyProperty.OverrideMetadata(typeof(ListView), new FrameworkPropertyMetadata(typeof(ListView))); + DefaultStyleKeyProperty.OverrideMetadata( + typeof(ListView), + new FrameworkPropertyMetadata(typeof(ListView)) + ); + } + + protected override DependencyObject GetContainerForItemOverride() + { + return new ListViewItem(); + } + + protected override bool IsItemItsOwnContainerOverride(object item) + { + return item is ListViewItem; } } diff --git a/src/Wpf.Ui/Controls/ListView/ListView.xaml b/src/Wpf.Ui/Controls/ListView/ListView.xaml index 1af21cff0..6e6eb9711 100644 --- a/src/Wpf.Ui/Controls/ListView/ListView.xaml +++ b/src/Wpf.Ui/Controls/ListView/ListView.xaml @@ -59,8 +59,9 @@ Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> - + - - - - + - + - + - - -