diff --git a/.github/labeler.yml b/.github/labeler.yml index 56acb887f..1516e2e58 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,29 +1,40 @@ ---- PR: - "*" +dotnet: + - '**/*.cs' + github_actions: - - .github/workflows/* + - ".github/workflows/*" documentation: - - docs/* + - "docs/*" update: - - src/Directory.Build.props + - "src/Directory.Build.props" -controls: - - src/Wpf.Ui/Controls/* +dependencies: + - "src/Packages.props" + - "branding/package.json" + - "src/Packages.props" + +NuGet: + - "src/Packages.props" styles: - - src/Wpf.Ui/Styles/* + - "src/Wpf.Ui/**/*.xaml" -icons: - - src/Wpf.Ui/Fonts/FluentSystemIcons-Filled.ttf - - src/Wpf.Ui/Fonts/FluentSystemIcons-Regular.ttf +themes: + - "src/Wpf.Ui/Appearance/*" -dependencies: - - src/Packages.props - - branding/package.json +tray: + - "src/Wpf.Ui.Tray/*" -NuGet: - - src/Packages.props +controls: + - "src/Wpf.Ui/Controls/*" + +icons: + - "src/Wpf.Ui/Resources/Fonts/*" + +navigation: + - "src/Wpf.Ui/Controls/NavigationView/*" diff --git a/.github/labels.yml b/.github/labels.yml index 396124380..fa1849006 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -1,4 +1,3 @@ ---- - name: "icons" color: "86CBEC" description: "Fonts and icons updates" @@ -47,6 +46,9 @@ - name: ".NET" color: "7121c6" description: "Pull requests that update .NET code." +- name: "dotnet" + color: "7121c6" + description: "Pull requests that update .NET code." - name: "NuGet" color: "004880" description: "Update of the NuGet package." @@ -71,3 +73,4 @@ - name: "wontfix" color: "ffffff" description: "This will not be worked on." + diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000..884f651c4 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,39 @@ +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + branches: [ development ] + +jobs: + analyze: + name: Analyze + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - uses: microsoft/setup-msbuild@v1.3 + with: + msbuild-architecture: x64 + + - name: Setup .NET Core SDK 8.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + - name: Install dependencies + run: dotnet restore + + - name: Build + run: dotnet build src\Wpf.Ui.Gallery\Wpf.Ui.Gallery.csproj --configuration Release --no-restore + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: "csharp" + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/Directory.Build.props b/Directory.Build.props index 5214885e2..a09c48302 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 3.0.0 + 3.0.1 12.0 true diff --git a/README.md b/README.md index 5650a4fb9..9e2eefa6c 100644 --- a/README.md +++ b/README.md @@ -127,15 +127,16 @@ public partial class MainWindow Now you can create fantastic apps, e.g. with one button: ```xml - - - - - + + + + + + + ``` ## Special thanks diff --git a/src/Wpf.Ui/Appearance/ApplicationThemeManager.cs b/src/Wpf.Ui/Appearance/ApplicationThemeManager.cs index a4f7b7694..b96e2cbbb 100644 --- a/src/Wpf.Ui/Appearance/ApplicationThemeManager.cs +++ b/src/Wpf.Ui/Appearance/ApplicationThemeManager.cs @@ -233,7 +233,7 @@ public static void ApplySystemTheme(bool updateAccent) themeToSet = ApplicationTheme.HighContrast; } - Apply(themeToSet); + Apply(themeToSet, updateAccent: updateAccent); } /// diff --git a/src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml b/src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml index d63fb518d..2e8e596c6 100644 --- a/src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml +++ b/src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml @@ -20,7 +20,7 @@ 1,1,1,1 0,0,0,2 8,0,10,0 - 3,2,3,0 + 6,4,6,0 10,8,8,8 11.0 32.0 @@ -92,7 +92,6 @@ - @@ -101,10 +100,10 @@ - + - + + + diff --git a/src/Wpf.Ui/Controls/NavigationView/NavigationView.Properties.cs b/src/Wpf.Ui/Controls/NavigationView/NavigationView.Properties.cs index 592ef644c..4c5ecd779 100644 --- a/src/Wpf.Ui/Controls/NavigationView/NavigationView.Properties.cs +++ b/src/Wpf.Ui/Controls/NavigationView/NavigationView.Properties.cs @@ -7,6 +7,7 @@ // Copyright(c) Microsoft Corporation.All rights reserved. using System.Collections; +using System.Collections.Specialized; using System.Windows.Controls; using Wpf.Ui.Animations; @@ -82,7 +83,7 @@ public partial class NavigationView nameof(FooterMenuItemsProperty), typeof(IList), typeof(NavigationView), - new FrameworkPropertyMetadata(null) + new FrameworkPropertyMetadata(null, OnFooterMenuItemsPropertyChanged) ); /// @@ -513,16 +514,45 @@ private static void OnMenuItemsPropertyChanged(DependencyObject? d, DependencyPr if (navigationView.MenuItemsItemsControl is null) { + navigationView.UpdateCollectionChangedEvent(e.OldValue as IList, e.NewValue as IList); return; } if (navigationView.MenuItemsItemsControl.ItemsSource.Equals(enumerableNewValue)) { + navigationView.UpdateMenuItemsTemplate(enumerableNewValue); return; } navigationView.MenuItemsItemsControl.ItemsSource = null; navigationView.MenuItemsItemsControl.ItemsSource = enumerableNewValue; + navigationView.UpdateMenuItemsTemplate(enumerableNewValue); + navigationView.AddItemsToDictionaries(enumerableNewValue); + + navigationView.UpdateCollectionChangedEvent(e.OldValue as IList, e.NewValue as IList); + } + + private void UpdateCollectionChangedEvent(IList? oldMenuItems, IList? newMenuItems) + { + if(oldMenuItems is INotifyCollectionChanged notifyCollection) + { + notifyCollection.CollectionChanged -= OnMenuItems_CollectionChanged; + } + if(newMenuItems is INotifyCollectionChanged newNotifyCollection) + { + newNotifyCollection.CollectionChanged += OnMenuItems_CollectionChanged; + } + } + + private void OnMenuItems_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + { + if (e.NewItems is null) + { + return; + } + + UpdateMenuItemsTemplate(e.NewItems); + AddItemsToDictionaries(e.NewItems); } private static void OnMenuItemsSourcePropertyChanged( @@ -551,6 +581,31 @@ DependencyPropertyChangedEventArgs e navigationView.FooterMenuItems = enumerableNewValue; } + private static void OnFooterMenuItemsPropertyChanged(DependencyObject? d, DependencyPropertyChangedEventArgs e) + { + if (d is not NavigationView navigationView || e.NewValue is not IList enumerableNewValue) + { + return; + } + + if (navigationView.FooterMenuItemsItemsControl is null) + { + navigationView.UpdateCollectionChangedEvent(e.OldValue as IList, e.NewValue as IList); + return; + } + + if (navigationView.FooterMenuItemsItemsControl.ItemsSource.Equals(enumerableNewValue)) + { + return; + } + + navigationView.FooterMenuItemsItemsControl.ItemsSource = null; + navigationView.FooterMenuItemsItemsControl.ItemsSource = enumerableNewValue; + navigationView.UpdateMenuItemsTemplate(enumerableNewValue); + navigationView.AddItemsToDictionaries(enumerableNewValue); + navigationView.UpdateCollectionChangedEvent(e.OldValue as IList, e.NewValue as IList); + } + private static void OnPaneDisplayModePropertyChanged( DependencyObject? d, DependencyPropertyChangedEventArgs e diff --git a/src/Wpf.Ui/Controls/NavigationView/NavigationViewCompact.xaml b/src/Wpf.Ui/Controls/NavigationView/NavigationViewCompact.xaml index 78d2e1c60..29b31e856 100644 --- a/src/Wpf.Ui/Controls/NavigationView/NavigationViewCompact.xaml +++ b/src/Wpf.Ui/Controls/NavigationView/NavigationViewCompact.xaml @@ -17,7 +17,7 @@ @@ -138,6 +140,7 @@ CommandParameter="increment" Cursor="Arrow" Foreground="{DynamicResource TextControlButtonForeground}" + IsTabStop="False" Visibility="Collapsed"> @@ -162,6 +165,7 @@ Cursor="Arrow" FontSize="{StaticResource NumberBoxButtonIconSize}" Foreground="{DynamicResource TextControlButtonForeground}" + IsTabStop="False" Visibility="Collapsed"> @@ -175,6 +179,7 @@ VerticalAlignment="Top" Content="{TemplateBinding Icon}" FontSize="16" + IsTabStop="False" Foreground="{TemplateBinding Foreground}" /> diff --git a/src/Wpf.Ui/Controls/PasswordBox/PasswordBox.xaml b/src/Wpf.Ui/Controls/PasswordBox/PasswordBox.xaml index 862188d46..6d02f27e8 100644 --- a/src/Wpf.Ui/Controls/PasswordBox/PasswordBox.xaml +++ b/src/Wpf.Ui/Controls/PasswordBox/PasswordBox.xaml @@ -206,6 +206,7 @@ Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}" CommandParameter="clear" Cursor="Arrow" + IsTabStop="False" Foreground="{DynamicResource TextControlButtonForeground}"> @@ -229,6 +230,7 @@ Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}" CommandParameter="reveal" Cursor="Arrow" + IsTabStop="False" Foreground="{DynamicResource TextControlButtonForeground}"> diff --git a/src/Wpf.Ui/Controls/ProgressBar/ProgressBar.xaml b/src/Wpf.Ui/Controls/ProgressBar/ProgressBar.xaml index 9c3e1be21..cced092ad 100644 --- a/src/Wpf.Ui/Controls/ProgressBar/ProgressBar.xaml +++ b/src/Wpf.Ui/Controls/ProgressBar/ProgressBar.xaml @@ -1,4 +1,4 @@ -