From 8972991e16f3c5061ea7e003c6e236fc1bfc3267 Mon Sep 17 00:00:00 2001 From: Nicolai Henriksen Date: Sat, 22 Jun 2024 09:38:50 +0200 Subject: [PATCH] Live stream review comment fix + primary constructor (#3611) --- src/MaterialDesignThemes.Wpf/RatingBarButton.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/MaterialDesignThemes.Wpf/RatingBarButton.cs b/src/MaterialDesignThemes.Wpf/RatingBarButton.cs index e8596bae6a..a32f1c4251 100644 --- a/src/MaterialDesignThemes.Wpf/RatingBarButton.cs +++ b/src/MaterialDesignThemes.Wpf/RatingBarButton.cs @@ -1,6 +1,6 @@ namespace MaterialDesignThemes.Wpf; -public class RatingBarButton : ButtonBase +public class RatingBarButton(RatingBar ratingBar) : ButtonBase { static RatingBarButton() { @@ -21,12 +21,10 @@ public int Value internal set => SetValue(ValuePropertyKey, value); } - public RatingBar RatingBar { get; } = null!; // Null initializer added to suppress warning (for the obsoleted empty constructor) - - public RatingBarButton(RatingBar ratingBar) => RatingBar = ratingBar; + public RatingBar RatingBar { get; } = ratingBar; // Only added the default constructor for back-compat. Ideally should not be used from MDIX consumers, but you never know. [Obsolete("Should not be used. Use the constructor taking a RatingBar instance as parameter instead. This constructor will be removed in a future version.")] - public RatingBarButton() + public RatingBarButton() : this(null!) { } }