diff --git a/.editorconfig b/.editorconfig
index 301fb13a8..1512d3664 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -355,7 +355,6 @@ dotnet_diagnostic.SA1009.severity = none
# Hide warnings when using the new() expression from C# 9.
dotnet_diagnostic.SA1000.severity = none
-
dotnet_diagnostic.SA1011.severity = none
dotnet_diagnostic.SA1101.severity = none
@@ -389,12 +388,16 @@ dotnet_diagnostic.SA1634.severity = none
dotnet_diagnostic.SA1652.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.CS1591.severity = none # Missing XML comment for publicly visible type or member
+ # 15000+ warnings in the solution
+dotnet_diagnostic.CA1510.severity = none # Use ArgumentNullException throw helper
+ # doesn't work with older versions of .NET
+
dotnet_diagnostic.SA1518.severity = none
dotnet_diagnostic.SA1615.severity = none
dotnet_diagnostic.SA1502.severity = none
@@ -407,9 +410,5 @@ dotnet_diagnostic.WPF0071.severity = none # Add ValueConversion attribute
dotnet_diagnostic.WPF0070.severity = none # Add default field to converter
# Suppress some IDE warnings
+dotnet_diagnostic.IDE0130.severity = none # Hide warnings about namespaces not matching folder structure
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor
-dotnet_diagnostic.CS1591.severity = none # Missing XML comment for publicly visible type or member
- # 15000+ warnings in the solution
-dotnet_diagnostic.CA1510.severity = none # Use ArgumentNullException throw helper
- # doesn't work with older versions of .NET
-
\ No newline at end of file
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 46f0814d5..71d45f8a4 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,30 +1,30 @@
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
+
-
-
+
+
\ No newline at end of file
diff --git a/src/Wpf.Ui.Abstractions/Controls/INavigationAware.cs b/src/Wpf.Ui.Abstractions/Controls/INavigationAware.cs
index 8843b52cb..8f9a087cb 100644
--- a/src/Wpf.Ui.Abstractions/Controls/INavigationAware.cs
+++ b/src/Wpf.Ui.Abstractions/Controls/INavigationAware.cs
@@ -14,7 +14,6 @@ public interface INavigationAware
/// Asynchronously handles the event that is fired after the component is navigated to.
///
/// A task that represents the asynchronous operation.
-
Task OnNavigatedToAsync();
///
diff --git a/src/Wpf.Ui.Abstractions/NavigationException.cs b/src/Wpf.Ui.Abstractions/NavigationException.cs
index ccf3b9981..c1d46e44f 100644
--- a/src/Wpf.Ui.Abstractions/NavigationException.cs
+++ b/src/Wpf.Ui.Abstractions/NavigationException.cs
@@ -11,14 +11,15 @@ namespace Wpf.Ui.Abstractions;
public sealed class NavigationException : Exception
{
///
- /// Initializes a new instance of the NavigationException class with a specified error message.
+ /// Initializes a new instance of the class with a specified error message.
///
/// The message that describes the error.
public NavigationException(string message)
: base(message) { }
///
- /// Initializes a new instance of the NavigationException class with a specified error message and a reference to the inner exception that is the cause of this exception.
+ /// Initializes a new instance of the class with a specified error message
+ /// and a reference to the inner exception that is the cause of this exception.
///
/// The exception that is the cause of the current exception.
/// The message that describes the error.
diff --git a/src/Wpf.Ui.Abstractions/Wpf.Ui.Abstractions.csproj b/src/Wpf.Ui.Abstractions/Wpf.Ui.Abstractions.csproj
index 332b5d0ac..b802b5d58 100644
--- a/src/Wpf.Ui.Abstractions/Wpf.Ui.Abstractions.csproj
+++ b/src/Wpf.Ui.Abstractions/Wpf.Ui.Abstractions.csproj
@@ -6,6 +6,7 @@
true
Abstractions for the WPF UI.
$(CommonTags);abstractions;standard
+ <_SilenceIsAotCompatibleUnsupportedWarning>true
diff --git a/src/Wpf.Ui.DependencyInjection/ServiceCollectionExtensions.cs b/src/Wpf.Ui.DependencyInjection/ServiceCollectionExtensions.cs
index 71a7be708..1d9264743 100644
--- a/src/Wpf.Ui.DependencyInjection/ServiceCollectionExtensions.cs
+++ b/src/Wpf.Ui.DependencyInjection/ServiceCollectionExtensions.cs
@@ -18,7 +18,6 @@ public static class ServiceCollectionExtensions
///
/// The to add the services to.
/// The so that additional calls can be chained.
-
public static IServiceCollection AddNavigationViewPageProvider(this IServiceCollection services)
{
_ = services.AddSingleton<
diff --git a/src/Wpf.Ui.DependencyInjection/Wpf.Ui.DependencyInjection.csproj b/src/Wpf.Ui.DependencyInjection/Wpf.Ui.DependencyInjection.csproj
index 421efb133..422e8c970 100644
--- a/src/Wpf.Ui.DependencyInjection/Wpf.Ui.DependencyInjection.csproj
+++ b/src/Wpf.Ui.DependencyInjection/Wpf.Ui.DependencyInjection.csproj
@@ -6,6 +6,7 @@
true
Dependency injection for the WPF UI.
$(CommonTags);dependency;injection;abstractions;standard
+ <_SilenceIsAotCompatibleUnsupportedWarning>true
diff --git a/src/Wpf.Ui.Extension/Wpf.Ui.Extension.csproj b/src/Wpf.Ui.Extension/Wpf.Ui.Extension.csproj
index e8d50a5a5..c527e61b8 100644
--- a/src/Wpf.Ui.Extension/Wpf.Ui.Extension.csproj
+++ b/src/Wpf.Ui.Extension/Wpf.Ui.Extension.csproj
@@ -89,12 +89,6 @@
Designer
-
-
- compile; build; native; contentfiles; analyzers; buildtransitive
-
-
-
Always
diff --git a/src/Wpf.Ui.Gallery/Controllers/MonacoController.cs b/src/Wpf.Ui.Gallery/Controllers/MonacoController.cs
index 9530789b0..9283f5c26 100644
--- a/src/Wpf.Ui.Gallery/Controllers/MonacoController.cs
+++ b/src/Wpf.Ui.Gallery/Controllers/MonacoController.cs
@@ -56,7 +56,7 @@ public async Task SetLanguageAsync(MonacoLanguage monacoLanguage)
var languageId =
monacoLanguage == MonacoLanguage.ObjectiveC ? "objective-c" : monacoLanguage.ToString().ToLower();
- await _webView.ExecuteScriptAsync(
+ _ = await _webView.ExecuteScriptAsync(
"monaco.editor.setModelLanguage(" + EditorObject + $".getModel(), \"{languageId}\");"
);
}
@@ -65,7 +65,7 @@ public async Task SetContentAsync(string contents)
{
var literalContents = SymbolDisplay.FormatLiteral(contents, false);
- await _webView.ExecuteScriptAsync(EditorObject + $".setValue(\"{literalContents}\");");
+ _ = await _webView.ExecuteScriptAsync(EditorObject + $".setValue(\"{literalContents}\");");
}
public void DispatchScript(string script)
@@ -75,6 +75,6 @@ public void DispatchScript(string script)
return;
}
- Application.Current.Dispatcher.InvokeAsync(async () => await _webView!.ExecuteScriptAsync(script));
+ _ = Application.Current.Dispatcher.InvokeAsync(async () => await _webView!.ExecuteScriptAsync(script));
}
}
diff --git a/src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml.cs b/src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml.cs
index f198369fd..1a3b401a9 100644
--- a/src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml.cs
@@ -50,7 +50,7 @@ private void OnTemplateButtonClick(Type? pageType)
if (pageType is not null)
{
- navigationService.Navigate(pageType);
+ _ = navigationService.Navigate(pageType);
}
System.Diagnostics.Debug.WriteLine(
diff --git a/src/Wpf.Ui.Gallery/ViewModels/Windows/MonacoWindowViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Windows/MonacoWindowViewModel.cs
index 554e6a95e..0b782815a 100644
--- a/src/Wpf.Ui.Gallery/ViewModels/Windows/MonacoWindowViewModel.cs
+++ b/src/Wpf.Ui.Gallery/ViewModels/Windows/MonacoWindowViewModel.cs
@@ -54,7 +54,7 @@ private void OnWebViewNavigationCompleted(
Microsoft.Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs e
)
{
- DispatchAsync(InitializeEditorAsync);
+ _ = DispatchAsync(InitializeEditorAsync);
}
private static DispatcherOperation DispatchAsync(Func callback)
diff --git a/src/Wpf.Ui.SyntaxHighlight/Controls/CodeBlock.cs b/src/Wpf.Ui.SyntaxHighlight/Controls/CodeBlock.cs
index 3650ee772..149b0d98f 100644
--- a/src/Wpf.Ui.SyntaxHighlight/Controls/CodeBlock.cs
+++ b/src/Wpf.Ui.SyntaxHighlight/Controls/CodeBlock.cs
@@ -40,21 +40,21 @@ public class CodeBlock : System.Windows.Controls.ContentControl
);
///
- /// Formatted .
+ /// Gets the formatted .
///
- public object SyntaxContent
+ public object? SyntaxContent
{
get => GetValue(SyntaxContentProperty);
internal set => SetValue(SyntaxContentProperty, value);
}
///
- /// Command triggered after clicking the control button.
+ /// Gets the command triggered after clicking the control button.
///
public IRelayCommand ButtonCommand => (IRelayCommand)GetValue(ButtonCommandProperty);
///
- /// Creates new instance and assigns default action.
+ /// Initializes a new instance of the class, and assigns default action.
///
public CodeBlock()
{
@@ -94,7 +94,7 @@ protected virtual void UpdateSyntax()
richTextBox.Document.Blocks.Clear();
richTextBox.Document.Blocks.Add(Highlighter.FormatAsParagraph(_sourceCode));
- SyntaxContent = richTextBox;
+ SetCurrentValue(SyntaxContentProperty, richTextBox);
}
private void OnTemplateButtonClick(string? _)
diff --git a/src/Wpf.Ui.SyntaxHighlight/Highlighter.cs b/src/Wpf.Ui.SyntaxHighlight/Highlighter.cs
index 73d4391be..469c76a22 100644
--- a/src/Wpf.Ui.SyntaxHighlight/Highlighter.cs
+++ b/src/Wpf.Ui.SyntaxHighlight/Highlighter.cs
@@ -4,7 +4,7 @@
// All Rights Reserved.
// TODO: This class is work in progress.
-
+//
using System;
using System.Linq;
using System.Text.RegularExpressions;
@@ -38,17 +38,18 @@ internal static class Highlighter
private const string EntityPattern = /* language=regex */
@"(&[a-zA-Z0-9#]+;)";
- //private const string PunctuationPattern = /* language=regex */
+ // private const string PunctuationPattern = /* language=regex */
// @"(!==?|(?:[[\\] ()\{\}.:;,+\\-?=!]|<|>)+|&&|\\|\\|)";
- //private const string NumberPattern = /* language=regex */
+ // private const string NumberPattern = /* language=regex */
// @"(-? (?:\.\d+|\d+(?:\.\d+)?))";
- //private const string BooleanPattern = /* language=regex */
+ // private const string BooleanPattern = /* language=regex */
// "\b(true|false)\b";
- //private const string AttributePattern = /* language=regex */
- // "(\\s*)([a-zA-Z\\d\\-:]+)=(\" | ')(.*?)\\3";
+ // private const string AttributePattern = /* language=regex */
+ // "(\\s*)([a-zA-Z\\d\\-:]+)=(\" | ')(.*?)\\3";
+ ////
public static Paragraph FormatAsParagraph(
string code,
diff --git a/src/Wpf.Ui.SyntaxHighlight/Markup/ControlsDictionary.cs b/src/Wpf.Ui.SyntaxHighlight/Markup/SyntaxHighlightDictionary.cs
similarity index 83%
rename from src/Wpf.Ui.SyntaxHighlight/Markup/ControlsDictionary.cs
rename to src/Wpf.Ui.SyntaxHighlight/Markup/SyntaxHighlightDictionary.cs
index 74670ed2e..db73d4572 100644
--- a/src/Wpf.Ui.SyntaxHighlight/Markup/ControlsDictionary.cs
+++ b/src/Wpf.Ui.SyntaxHighlight/Markup/SyntaxHighlightDictionary.cs
@@ -21,7 +21,8 @@ public class SyntaxHighlightDictionary : ResourceDictionary
"pack://application:,,,/Wpf.Ui.SyntaxHighlight;component/SyntaxHighlight.xaml";
///
- /// Default constructor defining of the WPF UI syntax highlight dictionary.
+ /// Initializes a new instance of the class.
+ /// It sets the of the WPF UI syntax highlight dictionary.
///
public SyntaxHighlightDictionary() => Source = new Uri(DictionaryUri, UriKind.Absolute);
}
diff --git a/src/Wpf.Ui.Tray/Hicon.cs b/src/Wpf.Ui.Tray/Hicon.cs
index 16ec08f89..b11516b94 100644
--- a/src/Wpf.Ui.Tray/Hicon.cs
+++ b/src/Wpf.Ui.Tray/Hicon.cs
@@ -5,7 +5,7 @@
// TODO: This class is the only reason for using System.Drawing.Common.
// It is worth looking for a way to get hIcon without using it.
-
+//
using System.Drawing;
using System.Windows.Media;
using System.Windows.Media.Imaging;
diff --git a/src/Wpf.Ui.Tray/Internal/InternalNotifyIconManager.cs b/src/Wpf.Ui.Tray/Internal/InternalNotifyIconManager.cs
index 213b4f9a6..fdd299344 100644
--- a/src/Wpf.Ui.Tray/Internal/InternalNotifyIconManager.cs
+++ b/src/Wpf.Ui.Tray/Internal/InternalNotifyIconManager.cs
@@ -177,7 +177,7 @@ protected virtual void OpenMenu()
}
// Without setting the handler window at the front, menu may appear behind the taskbar
- Interop.User32.SetForegroundWindow(HookWindow.Handle);
+ _ = Interop.User32.SetForegroundWindow(HookWindow.Handle);
ContextMenuService.SetPlacement(ContextMenu, PlacementMode.MousePoint);
// ContextMenu.ApplyMica();
@@ -259,7 +259,7 @@ protected virtual void Dispose(bool disposing)
"Wpf.Ui.NotifyIcon"
);
- Unregister();
+ _ = Unregister();
}
///
diff --git a/src/Wpf.Ui.Tray/Interop/Shell32.cs b/src/Wpf.Ui.Tray/Interop/Shell32.cs
index 594e563e0..9ed503ebe 100644
--- a/src/Wpf.Ui.Tray/Interop/Shell32.cs
+++ b/src/Wpf.Ui.Tray/Interop/Shell32.cs
@@ -11,6 +11,7 @@ namespace Wpf.Ui.Tray.Interop;
// ReSharper disable InconsistentNaming
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
#pragma warning disable SA1401 // Fields should be private
+#pragma warning disable CA1060 // Move pinvokes to native methods class
///
/// The Windows UI provides users with access to a wide variety of objects necessary to run applications and manage the operating system.
@@ -178,3 +179,4 @@ public static extern int GetCurrentProcessExplicitAppUserModelID(
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter
#pragma warning restore SA1401 // Fields should be private
+#pragma warning restore CA1060 // Move pinvokes to native methods class
diff --git a/src/Wpf.Ui.Tray/Interop/User32.cs b/src/Wpf.Ui.Tray/Interop/User32.cs
index 2c41c2530..567438008 100644
--- a/src/Wpf.Ui.Tray/Interop/User32.cs
+++ b/src/Wpf.Ui.Tray/Interop/User32.cs
@@ -11,6 +11,7 @@ namespace Wpf.Ui.Tray.Interop;
// 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 CA1060 // Move pinvokes to native methods class
///
/// USER procedure declarations, constant definitions and macros.
@@ -1546,3 +1547,4 @@ public static extern int GetWindowCompositionAttribute(
#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 CA1060 // Move pinvokes to native methods class
diff --git a/src/Wpf.Ui.Tray/NotifyIconService.cs b/src/Wpf.Ui.Tray/NotifyIconService.cs
index 41b8a078e..40166d413 100644
--- a/src/Wpf.Ui.Tray/NotifyIconService.cs
+++ b/src/Wpf.Ui.Tray/NotifyIconService.cs
@@ -7,6 +7,8 @@
using System.Windows.Controls;
using System.Windows.Media;
+#pragma warning disable CA1001 // Types that own disposable fields should be disposable
+
namespace Wpf.Ui.Tray;
///
@@ -119,3 +121,5 @@ private void RegisterHandlers()
internalNotifyIconManager.MiddleDoubleClick += OnMiddleDoubleClick;
}
}
+
+#pragma warning restore CA1001 // Types that own disposable fields should be disposable
diff --git a/src/Wpf.Ui/Appearance/ObservedWindow.cs b/src/Wpf.Ui/Appearance/ObservedWindow.cs
index 44e4c586c..dc0279896 100644
--- a/src/Wpf.Ui/Appearance/ObservedWindow.cs
+++ b/src/Wpf.Ui/Appearance/ObservedWindow.cs
@@ -15,7 +15,7 @@ internal class ObservedWindow
private readonly HwndSource _source;
///
- /// Initializes a new instance of the ObservedWindow class.
+ /// Initializes a new instance of the class.
///
/// The handle of the window.
/// The backdrop type of the window.
diff --git a/src/Wpf.Ui/Controls/Arc/Arc.cs b/src/Wpf.Ui/Controls/Arc/Arc.cs
index 85dd425e1..e3bd1caf1 100644
--- a/src/Wpf.Ui/Controls/Arc/Arc.cs
+++ b/src/Wpf.Ui/Controls/Arc/Arc.cs
@@ -52,13 +52,13 @@ public class Arc : Shape
new PropertyMetadata(SweepDirection.Clockwise, PropertyChangedCallback)
);
- /// Identifies the dependency property.
- public static readonly DependencyProperty StrokeStartLineCapProperty = DependencyProperty.Register(
- nameof(StrokeStartLineCap),
- typeof(PenLineCap),
- typeof(Arc),
- new PropertyMetadata(PenLineCap.Round, PropertyChangedCallback)
- );
+ static Arc()
+ {
+ // Modify the metadata of the StrokeStartLineCap dependency property.
+ StrokeStartLineCapProperty.OverrideMetadata(
+ typeof(Arc),
+ new PropertyMetadata(PenLineCap.Round, PropertyChangedCallback));
+ }
///
/// Gets or sets the initial angle from which the arc will be drawn.
@@ -87,13 +87,6 @@ public SweepDirection SweepDirection
set => SetValue(SweepDirectionProperty, value);
}
- // TODO: Should we?
- public new PenLineCap StrokeStartLineCap
- {
- get { return (PenLineCap)GetValue(StrokeStartLineCapProperty); }
- set { SetValue(StrokeStartLineCapProperty, value); }
- }
-
///
/// Gets a value indicating whether one of the two larger arc sweeps is chosen; otherwise, if is , one of the smaller arc sweeps is chosen.
///
diff --git a/src/Wpf.Ui/Controls/BreadcrumbBar/BreadcrumbBarItem.cs b/src/Wpf.Ui/Controls/BreadcrumbBar/BreadcrumbBarItem.cs
index 442354e00..7b8de1274 100644
--- a/src/Wpf.Ui/Controls/BreadcrumbBar/BreadcrumbBarItem.cs
+++ b/src/Wpf.Ui/Controls/BreadcrumbBar/BreadcrumbBarItem.cs
@@ -5,8 +5,6 @@
/* Based on Windows UI Library */
-
-
// ReSharper disable once CheckNamespace
namespace Wpf.Ui.Controls;
diff --git a/src/Wpf.Ui/Controls/DynamicScrollBar/DynamicScrollBar.cs b/src/Wpf.Ui/Controls/DynamicScrollBar/DynamicScrollBar.cs
index 607e0b085..31432f457 100644
--- a/src/Wpf.Ui/Controls/DynamicScrollBar/DynamicScrollBar.cs
+++ b/src/Wpf.Ui/Controls/DynamicScrollBar/DynamicScrollBar.cs
@@ -81,7 +81,7 @@ protected override void OnMouseEnter(MouseEventArgs e)
{
base.OnMouseEnter(e);
- UpdateScroll().GetAwaiter();
+ _ = UpdateScrollAsync();
}
///
@@ -91,10 +91,10 @@ protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
- UpdateScroll().GetAwaiter();
+ _ = UpdateScrollAsync();
}
- private async Task UpdateScroll()
+ private async Task UpdateScrollAsync()
{
var currentEvent = _interactiveIdentifier.GetNext();
var shouldScroll = IsMouseOver || _isScrolling;
@@ -131,7 +131,7 @@ private static void OnIsScrollingChanged(DependencyObject d, DependencyPropertyC
bar._isScrolling = !bar._isScrolling;
- bar.UpdateScroll().GetAwaiter();
+ _ = bar.UpdateScrollAsync();
}
private static void OnIsInteractedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@@ -148,6 +148,6 @@ private static void OnIsInteractedChanged(DependencyObject d, DependencyProperty
bar._isInteracted = !bar._isInteracted;
- bar.UpdateScroll().GetAwaiter();
+ _ = bar.UpdateScrollAsync();
}
}
diff --git a/src/Wpf.Ui/Controls/NavigationView/NavigationView.Properties.cs b/src/Wpf.Ui/Controls/NavigationView/NavigationView.Properties.cs
index ea3716c88..47aa0758f 100644
--- a/src/Wpf.Ui/Controls/NavigationView/NavigationView.Properties.cs
+++ b/src/Wpf.Ui/Controls/NavigationView/NavigationView.Properties.cs
@@ -464,20 +464,28 @@ NotifyCollectionChangedEventArgs e
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
- foreach (var item in e.NewItems)
+ if (e.NewItems is not null)
{
- collection.Add(item);
+ foreach (var item in e.NewItems)
+ {
+ _ = collection.Add(item);
+ }
}
+
break;
case NotifyCollectionChangedAction.Remove:
- foreach (var item in e.OldItems)
+ if (e.OldItems is not null && e.NewItems is not null)
{
- if (!e.NewItems.Contains(item))
+ foreach (var item in e.OldItems)
{
- collection.Remove(item);
+ if (!e.NewItems.Contains(item))
+ {
+ collection.Remove(item);
+ }
}
}
+
break;
case NotifyCollectionChangedAction.Move:
@@ -488,7 +496,11 @@ NotifyCollectionChangedEventArgs e
case NotifyCollectionChangedAction.Replace:
collection.RemoveAt(e.OldStartingIndex);
- collection.Insert(e.OldStartingIndex, e.NewItems[0]);
+ if (e.NewItems is not null)
+ {
+ collection.Insert(e.OldStartingIndex, e.NewItems[0]);
+ }
+
break;
case NotifyCollectionChangedAction.Reset:
@@ -521,12 +533,12 @@ private static void OnMenuItemsSourceChanged(DependencyObject? d, DependencyProp
{
foreach (var item in newItemsSource)
{
- navigationView.MenuItems.Add(item);
+ _ = navigationView.MenuItems.Add(item);
}
}
else if (e.NewValue != null)
{
- navigationView.MenuItems.Add(e.NewValue);
+ _ = navigationView.MenuItems.Add(e.NewValue);
}
if (e.NewValue is INotifyCollectionChanged oc)
@@ -563,12 +575,12 @@ DependencyPropertyChangedEventArgs e
{
foreach (var item in newItemsSource)
{
- navigationView.FooterMenuItems.Add(item);
+ _ = navigationView.FooterMenuItems.Add(item);
}
}
else if (e.NewValue != null)
{
- navigationView.FooterMenuItems.Add(e.NewValue);
+ _ = navigationView.FooterMenuItems.Add(e.NewValue);
}
if (e.NewValue is INotifyCollectionChanged oc)
diff --git a/src/Wpf.Ui/Controls/NumberBox/NumberBox.cs b/src/Wpf.Ui/Controls/NumberBox/NumberBox.cs
index 7a256da2f..3af7e5991 100644
--- a/src/Wpf.Ui/Controls/NumberBox/NumberBox.cs
+++ b/src/Wpf.Ui/Controls/NumberBox/NumberBox.cs
@@ -9,7 +9,7 @@
// TODO: Constant decimals when formatting. Although this can actually be done with NumberFormatter.
// TODO: Disable expression by default
// TODO: Lock to digit characters only by property
-
+//
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
diff --git a/src/Wpf.Ui/Controls/Snackbar/SnackbarPresenter.cs b/src/Wpf.Ui/Controls/Snackbar/SnackbarPresenter.cs
index aba5a764e..0e5db4be1 100644
--- a/src/Wpf.Ui/Controls/Snackbar/SnackbarPresenter.cs
+++ b/src/Wpf.Ui/Controls/Snackbar/SnackbarPresenter.cs
@@ -77,7 +77,7 @@ public virtual void AddToQue(Snackbar snackbar)
if (Content is null)
{
- ShowQueuedSnackbars(); // TODO: Fix detached process
+ _ = ShowQueuedSnackbarsAsync(); // TODO: Fix detached process
}
}
@@ -86,7 +86,7 @@ public virtual async Task ImmediatelyDisplay(Snackbar snackbar)
await HideCurrent();
await ShowSnackbar(snackbar);
- await ShowQueuedSnackbars();
+ await ShowQueuedSnackbarsAsync();
}
public virtual async Task HideCurrent()
@@ -101,7 +101,7 @@ public virtual async Task HideCurrent()
ResetCancellationTokenSource();
}
- private async Task ShowQueuedSnackbars()
+ private async Task ShowQueuedSnackbarsAsync()
{
while (Queue.Count > 0 && !CancellationTokenSource.IsCancellationRequested)
{
diff --git a/src/Wpf.Ui/Controls/SymbolFilled.cs b/src/Wpf.Ui/Controls/SymbolFilled.cs
index 80291f6b8..59b4456c9 100644
--- a/src/Wpf.Ui/Controls/SymbolFilled.cs
+++ b/src/Wpf.Ui/Controls/SymbolFilled.cs
@@ -18,7 +18,6 @@ public enum SymbolFilled
Empty = 0x0,
// Automatically generated, may contain bugs.
-
AccessTime20 = 0xE000,
Accessibility32 = 0xE001,
Accessibility48 = 0xE002,
diff --git a/src/Wpf.Ui/Controls/SymbolRegular.cs b/src/Wpf.Ui/Controls/SymbolRegular.cs
index 1718746c7..77650f424 100644
--- a/src/Wpf.Ui/Controls/SymbolRegular.cs
+++ b/src/Wpf.Ui/Controls/SymbolRegular.cs
@@ -18,7 +18,6 @@ public enum SymbolRegular
Empty = 0x0,
// Automatically generated, may contain bugs.
-
AccessTime20 = 0xE000,
Accessibility32 = 0xE001,
Accessibility48 = 0xE002,
diff --git a/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs b/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs
index de59bde85..8a50f0c88 100644
--- a/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs
+++ b/src/Wpf.Ui/Controls/TitleBar/TitleBar.cs
@@ -224,7 +224,7 @@ public string? Title
///
/// Gets or sets the content displayed in the left side of the .
///
- public object Header
+ public object? Header
{
get => GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
@@ -233,7 +233,7 @@ public object Header
///
/// Gets or sets the content displayed in right side of the .
///
- public object TrailingContent
+ public object? TrailingContent
{
get => GetValue(TrailingContentProperty);
set => SetValue(TrailingContentProperty, value);
@@ -394,11 +394,11 @@ public event TypedEventHandler HelpClicked
public Action? MinimizeActionOverride { get; set; }
private readonly TitleBarButton[] _buttons = new TitleBarButton[4];
+ private readonly TextBlock _titleBlock;
private System.Windows.Window _currentWindow = null!;
/*private System.Windows.Controls.Grid _mainGrid = null!;*/
private System.Windows.Controls.ContentPresenter _icon = null!;
- private readonly TextBlock _titleBlock;
///
/// Initializes a new instance of the class and sets the default event.
@@ -411,11 +411,11 @@ public TitleBar()
_titleBlock = new TextBlock();
_titleBlock.VerticalAlignment = VerticalAlignment.Center;
- _titleBlock.SetBinding(
+ _ = _titleBlock.SetBinding(
System.Windows.Controls.TextBlock.TextProperty,
new Binding(nameof(Title)) { Source = this }
);
- _titleBlock.SetBinding(
+ _ = _titleBlock.SetBinding(
System.Windows.Controls.TextBlock.FontSizeProperty,
new Binding(nameof(FontSize)) { Source = this }
);
diff --git a/src/Wpf.Ui/Controls/VirtualizingWrapPanel/VirtualizingWrapPanel.cs b/src/Wpf.Ui/Controls/VirtualizingWrapPanel/VirtualizingWrapPanel.cs
index 1a58d4723..3392e2dee 100644
--- a/src/Wpf.Ui/Controls/VirtualizingWrapPanel/VirtualizingWrapPanel.cs
+++ b/src/Wpf.Ui/Controls/VirtualizingWrapPanel/VirtualizingWrapPanel.cs
@@ -425,10 +425,8 @@ protected override ItemRange UpdateItemRange()
int rowCountInCacheBefore = (int)(cacheBeforeInPixel / GetHeight(ChildSize));
int rowCountInCacheAfter =
(
- (int)
- Math.Ceiling(
- (offsetInPixel + viewportHeight + cacheAfterInPixel) / GetHeight(ChildSize)
- )
+ (int)Math.Ceiling(
+ (offsetInPixel + viewportHeight + cacheAfterInPixel) / GetHeight(ChildSize))
) - (int)Math.Ceiling((offsetInPixel + viewportHeight) / GetHeight(ChildSize));
startIndex = Math.Max(startIndex - (rowCountInCacheBefore * ItemsPerRowCount), 0);
diff --git a/src/Wpf.Ui/Controls/Window/WindowBackdrop.cs b/src/Wpf.Ui/Controls/Window/WindowBackdrop.cs
index 3b6d2261b..dcec2f18b 100644
--- a/src/Wpf.Ui/Controls/Window/WindowBackdrop.cs
+++ b/src/Wpf.Ui/Controls/Window/WindowBackdrop.cs
@@ -241,11 +241,11 @@ public static bool RemoveTitlebarBackground(System.Windows.Window? window)
// Specifying DWMWA_COLOR_DEFAULT (value 0xFFFFFFFF) for the color will reset the window back to using the system's default behavior for the caption color.
uint titlebarPvAttribute = 0xFFFFFFFE;
- Dwmapi.DwmSetWindowAttribute(
+ _ = Dwmapi.DwmSetWindowAttribute(
windowSource.Handle,
Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_CAPTION_COLOR,
ref titlebarPvAttribute,
- Marshal.SizeOf(typeof(uint))
+ sizeof(uint)
);
}
diff --git a/src/Wpf.Ui/Interop/Dwmapi.cs b/src/Wpf.Ui/Interop/Dwmapi.cs
index 01809bf97..2259c3281 100644
--- a/src/Wpf.Ui/Interop/Dwmapi.cs
+++ b/src/Wpf.Ui/Interop/Dwmapi.cs
@@ -17,6 +17,7 @@
// ReSharper disable IdentifierTypo
// ReSharper disable InconsistentNaming
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
+#pragma warning disable CA1060 // Move pinvokes to native methods class
using System.Runtime.InteropServices;
@@ -676,3 +677,4 @@ [In] int cbAttribute
}
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter
+#pragma warning restore CA1060 // Move pinvokes to native methods class
diff --git a/src/Wpf.Ui/Interop/Kernel32.cs b/src/Wpf.Ui/Interop/Kernel32.cs
index d66562109..a460c99cf 100644
--- a/src/Wpf.Ui/Interop/Kernel32.cs
+++ b/src/Wpf.Ui/Interop/Kernel32.cs
@@ -16,6 +16,8 @@
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
+#pragma warning disable CA1060 // Move pinvokes to native methods class
+
namespace Wpf.Ui.Interop;
///
@@ -45,3 +47,5 @@ internal class Kernel32
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsDebuggerPresent();
}
+
+#pragma warning restore CA1060 // Move pinvokes to native methods class
diff --git a/src/Wpf.Ui/Interop/ShObjIdl.cs b/src/Wpf.Ui/Interop/ShObjIdl.cs
index c30b0d50b..5c8efaae3 100644
--- a/src/Wpf.Ui/Interop/ShObjIdl.cs
+++ b/src/Wpf.Ui/Interop/ShObjIdl.cs
@@ -15,6 +15,8 @@
// ReSharper disable IdentifierTypo
// ReSharper disable InconsistentNaming
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
+#pragma warning disable CA1060 // Move pinvokes to native methods class
+
using System.Runtime.InteropServices;
namespace Wpf.Ui.Interop;
@@ -238,3 +240,4 @@ void SetOverlayIcon(
}
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter
+#pragma warning restore CA1060 // Move pinvokes to native methods class
diff --git a/src/Wpf.Ui/Interop/Shell32.cs b/src/Wpf.Ui/Interop/Shell32.cs
index 9b1a4de70..ce4580da6 100644
--- a/src/Wpf.Ui/Interop/Shell32.cs
+++ b/src/Wpf.Ui/Interop/Shell32.cs
@@ -16,6 +16,7 @@
// ReSharper disable InconsistentNaming
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
#pragma warning disable SA1401 // Fields should be private
+#pragma warning disable CA1060 // Move pinvokes to native methods class
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
@@ -188,3 +189,4 @@ public static extern int GetCurrentProcessExplicitAppUserModelID(
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter
#pragma warning restore SA1401 // Fields should be private
+#pragma warning restore CA1060 // Move pinvokes to native methods class
diff --git a/src/Wpf.Ui/Interop/UnsafeNativeMethods.cs b/src/Wpf.Ui/Interop/UnsafeNativeMethods.cs
index be8c6f217..16239fe5c 100644
--- a/src/Wpf.Ui/Interop/UnsafeNativeMethods.cs
+++ b/src/Wpf.Ui/Interop/UnsafeNativeMethods.cs
@@ -376,7 +376,9 @@ public static Color GetDwmColor()
return Color.FromArgb(255, values[2], values[1], values[0]);
}
- catch { }
+ catch
+ {
+ }
}
}
diff --git a/src/Wpf.Ui/Interop/User32.cs b/src/Wpf.Ui/Interop/User32.cs
index 20cabd542..43e39563d 100644
--- a/src/Wpf.Ui/Interop/User32.cs
+++ b/src/Wpf.Ui/Interop/User32.cs
@@ -21,6 +21,7 @@ namespace Wpf.Ui.Interop;
#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
+#pragma warning disable CA1060 // Move pinvokes to native methods class
///
/// USER procedure declarations, constant definitions and macros.
@@ -1598,3 +1599,4 @@ public static extern int GetWindowCompositionAttribute(
#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
+#pragma warning restore CA1060 // Move pinvokes to native methods class
diff --git a/src/Wpf.Ui/Interop/UxTheme.cs b/src/Wpf.Ui/Interop/UxTheme.cs
index 479e01915..ccc7cd130 100644
--- a/src/Wpf.Ui/Interop/UxTheme.cs
+++ b/src/Wpf.Ui/Interop/UxTheme.cs
@@ -20,6 +20,7 @@ namespace Wpf.Ui.Interop;
// ReSharper disable IdentifierTypo
// ReSharper disable InconsistentNaming
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
+#pragma warning disable CA1060 // Move pinvokes to native methods class
internal static class UxTheme
{
@@ -174,3 +175,4 @@ [In] int cchMaxSizeChars
}
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter
+#pragma warning restore CA1060 // Move pinvokes to native methods class
diff --git a/src/Wpf.Ui/Markup/Design.cs b/src/Wpf.Ui/Markup/Design.cs
index 3b44d0cd9..0be96b654 100644
--- a/src/Wpf.Ui/Markup/Design.cs
+++ b/src/Wpf.Ui/Markup/Design.cs
@@ -20,7 +20,7 @@ namespace Wpf.Ui.Markup;
///
public static class Design
{
- private static readonly string DesignProcessName = "devenv";
+ private const string DesignProcessName = "devenv";
private static bool? _inDesignMode;
@@ -29,12 +29,10 @@ public static class Design
///
private static bool InDesignMode =>
_inDesignMode ??=
- (bool)
- DependencyPropertyDescriptor
- .FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement))
- .Metadata.DefaultValue
- || System
- .Diagnostics.Process.GetCurrentProcess()
+ (bool)DependencyPropertyDescriptor
+ .FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement))
+ .Metadata.DefaultValue
+ || System.Diagnostics.Process.GetCurrentProcess()
.ProcessName.StartsWith(DesignProcessName, StringComparison.Ordinal);
public static readonly DependencyProperty BackgroundProperty = DependencyProperty.RegisterAttached(
diff --git a/src/Wpf.Ui/Markup/FontIconExtension.cs b/src/Wpf.Ui/Markup/FontIconExtension.cs
index c0e1bf655..8653eb537 100644
--- a/src/Wpf.Ui/Markup/FontIconExtension.cs
+++ b/src/Wpf.Ui/Markup/FontIconExtension.cs
@@ -49,7 +49,7 @@ public FontIconExtension(string glyph)
public override object ProvideValue(IServiceProvider serviceProvider)
{
- FontIcon fontIcon = new() { Glyph = Glyph, FontFamily = FontFamily };
+ FontIcon fontIcon = new() { Glyph = Glyph!, FontFamily = FontFamily };
if (FontSize > 0)
{
diff --git a/src/Wpf.Ui/UiApplication.cs b/src/Wpf.Ui/UiApplication.cs
index 43b1e92f2..abd57e07e 100644
--- a/src/Wpf.Ui/UiApplication.cs
+++ b/src/Wpf.Ui/UiApplication.cs
@@ -95,11 +95,14 @@ public ResourceDictionary Resources
_resources.MergedDictionaries.Add(themesDictionary);
_resources.MergedDictionaries.Add(controlsDictionary);
}
- catch { }
+ catch
+ {
+ }
}
return _application?.Resources ?? _resources;
}
+
set
{
if (_application is not null)