Skip to content

Commit

Permalink
Live stream review comment fix + primary constructor (#3611)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaihenriksen authored Jun 22, 2024
1 parent b3108ab commit 8972991
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/MaterialDesignThemes.Wpf/RatingBarButton.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace MaterialDesignThemes.Wpf;

public class RatingBarButton : ButtonBase
public class RatingBarButton(RatingBar ratingBar) : ButtonBase
{
static RatingBarButton()
{
Expand All @@ -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!)
{ }
}

0 comments on commit 8972991

Please sign in to comment.