Skip to content

Commit 7017150

Browse files
Rename to FillWhenTapped
1 parent 908207e commit 7017150

File tree

6 files changed

+34
-34
lines changed

6 files changed

+34
-34
lines changed

samples/CommunityToolkit.Maui.Sample/Pages/Views/RatingView/RatingViewCsharpPage.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ public RatingViewCsharpPage(RatingViewCsharpViewModel viewModel) : base(viewMode
400400
ShapeDiameter = largerSizeRatingViewHeight,
401401
MaximumRating = 5,
402402
Rating = 2.7,
403-
RatingViewTapFill = RatingViewTapFill.Background,
403+
FillWhenTapped = FillWhenTapped.Background,
404404
ShapeBorderThickness = 1
405405
}
406406
.Row(Row.ColorsItemFillRatingView).ColumnSpan(All<Column>())
@@ -647,7 +647,7 @@ public RatingViewCsharpPage(RatingViewCsharpViewModel viewModel) : base(viewMode
647647
IsReadOnly = false,
648648
ShapeDiameter = 30,
649649
MaximumRating = 7,
650-
RatingViewTapFill = RatingViewTapFill.Shape,
650+
FillWhenTapped = FillWhenTapped.Shape,
651651
ShapeBorderColor = Colors.Grey,
652652
ShapeBorderThickness = 1,
653653
Spacing = 3,
@@ -675,7 +675,7 @@ public RatingViewCsharpPage(RatingViewCsharpViewModel viewModel) : base(viewMode
675675
IsReadOnly = false,
676676
ShapeDiameter = 30,
677677
MaximumRating = 7,
678-
RatingViewTapFill = RatingViewTapFill.Background,
678+
FillWhenTapped = FillWhenTapped.Background,
679679
ShapeBorderColor = Colors.Grey,
680680
ShapeBorderThickness = 1,
681681
Spacing = 3,

samples/CommunityToolkit.Maui.Sample/Pages/Views/RatingView/RatingViewShowcasePage.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
ShapeDiameter="40"
5757
MaximumRating="5"
5858
Rating="{Binding ReviewSummaryAverage, Mode=OneWay}"
59-
RatingViewTapFill="Background"
59+
FillWhenTapped="Background"
6060
ShapeBorderThickness="0"
6161
Spacing="5"
6262
VerticalOptions="Center" />
@@ -119,7 +119,7 @@
119119
ShapeDiameter="40"
120120
MaximumRating="5"
121121
Rating="4.5"
122-
RatingViewTapFill="Background"
122+
FillWhenTapped="Background"
123123
ShapeBorderThickness="0"
124124
Spacing="5"
125125
VerticalOptions="Center" />
@@ -160,7 +160,7 @@
160160
ShapeDiameter="40"
161161
MaximumRating="5"
162162
Rating="4.9"
163-
RatingViewTapFill="Background"
163+
FillWhenTapped="Background"
164164
ShapeBorderColor="Black"
165165
ShapeBorderThickness="3"
166166
Spacing="5" />
@@ -176,7 +176,7 @@
176176
ShapeDiameter="40"
177177
MaximumRating="5"
178178
Rating="1"
179-
RatingViewTapFill="Background"
179+
FillWhenTapped="Background"
180180
ShapeBorderThickness="0"
181181
Spacing="5" />
182182
<Label Text="A positive golden trust review 4.5 out of 5" />
@@ -191,7 +191,7 @@
191191
ShapeDiameter="40"
192192
MaximumRating="5"
193193
Rating="4.5"
194-
RatingViewTapFill="Shape"
194+
FillWhenTapped="Shape"
195195
ShapeBorderThickness="0"
196196
Spacing="5">
197197
<toolkit:RatingView.Background>

samples/CommunityToolkit.Maui.Sample/Pages/Views/RatingView/RatingViewXamlPage.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@
320320
ShapeDiameter="40"
321321
MaximumRating="5"
322322
Rating="2.7"
323-
RatingViewTapFill="Shape"
323+
FillWhenTapped="Shape"
324324
SemanticProperties.Description="A RatingView showing the fill, empty and border color changes, shown using the fill type of 'Shape'."
325325
ShapeBorderColor="{Binding ColorPickerRatingShapeBorderColorTarget}"
326326
ShapeBorderThickness="1"
@@ -340,7 +340,7 @@
340340
ShapeDiameter="40"
341341
MaximumRating="5"
342342
Rating="2.7"
343-
RatingViewTapFill="Background"
343+
FillWhenTapped="Background"
344344
SemanticProperties.Description="A RatingView showing the fill, empty and border color changes, shown using the fill type of 'Background'."
345345
ShapeBorderColor="{Binding ColorPickerRatingShapeBorderColorTarget}"
346346
ShapeBorderThickness="1"
@@ -598,7 +598,7 @@
598598
ShapeDiameter="30"
599599
MaximumRating="7"
600600
Rating="{Binding Source={x:Reference RatingRatingView}, Path=Value, x:DataType=Slider}"
601-
RatingViewTapFill="Shape"
601+
FillWhenTapped="Shape"
602602
SemanticProperties.Description="A RatingView sample showing the rating changes and the fill type of 'Shape'."
603603
ShapeBorderColor="Grey"
604604
ShapeBorderThickness="1"
@@ -622,7 +622,7 @@
622622
ShapeDiameter="30"
623623
MaximumRating="7"
624624
Rating="{Binding Source={x:Reference RatingRatingView}, Path=Value, x:DataType=Slider}"
625-
RatingViewTapFill="Background"
625+
FillWhenTapped="Background"
626626
SemanticProperties.Description="A RatingView sample showing the rating changes and the fill type of 'Background'."
627627
ShapeBorderColor="Grey"
628628
ShapeBorderThickness="1"

src/CommunityToolkit.Maui.Core/Primitives/RatingViewTapFill.cs renamed to src/CommunityToolkit.Maui.Core/Primitives/FillWhenTapped.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace CommunityToolkit.Maui.Core;
22

33
/// <summary>RatingView selection determining which element of the RatingView Shape to fill when tapped</summary>
4-
public enum RatingViewTapFill
4+
public enum FillWhenTapped
55
{
66
/// <summary>Fill the shape when tapped</summary>
77
Shape,

src/CommunityToolkit.Maui.UnitTests/Views/RatingView/RatingViewTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void Defaults_ShouldHaveCorrectDefaultProperties()
7777
ratingView.ShapeBorderColor.Should().BeOfType<Color>().And.Be(RatingViewDefaults.ShapeBorderColor);
7878
ratingView.ShapeBorderThickness.Should().Be(RatingViewDefaults.ShapeBorderThickness);
7979
ratingView.Spacing.Should().Be(RatingViewDefaults.Spacing);
80-
ratingView.RatingViewTapFill.Should().BeOneOf(RatingViewTapFill.Shape).And.Be(RatingViewTapFill.Shape);
80+
ratingView.FillWhenTapped.Should().BeOneOf(FillWhenTapped.Shape).And.Be(FillWhenTapped.Shape);
8181
ratingView.CustomShapePath.Should().BeNull();
8282
}
8383

@@ -344,7 +344,7 @@ public void Properties_Change_EmptyShapeColor_Item()
344344
{
345345
MaximumRating = maximumRating,
346346
Rating = rating,
347-
RatingViewTapFill = RatingViewTapFill.Background
347+
FillWhenTapped = FillWhenTapped.Background
348348
};
349349
ratingView.EmptyShapeColor.Should().NotBe(emptyShapeColor);
350350
ratingView.EmptyShapeColor = emptyShapeColor;
@@ -384,7 +384,7 @@ public void Properties_Change_FilledShapeColor_Item()
384384
{
385385
MaximumRating = maximumRating,
386386
Rating = rating,
387-
RatingViewTapFill = RatingViewTapFill.Background
387+
FillWhenTapped = FillWhenTapped.Background
388388
};
389389
ratingView.FilledShapeColor.Should().NotBe(filledShapeColor);
390390
ratingView.BackgroundColor.Should().BeNull();
@@ -487,11 +487,11 @@ public void Properties_Change_Rating()
487487
[Fact]
488488
public void Properties_Change_RatingFill()
489489
{
490-
const RatingViewTapFill ratingFill = RatingViewTapFill.Background;
490+
const FillWhenTapped ratingFill = FillWhenTapped.Background;
491491
RatingView ratingView = new();
492-
ratingView.RatingViewTapFill.Should().NotBe(ratingFill);
493-
ratingView.RatingViewTapFill = ratingFill;
494-
ratingView.RatingViewTapFill.Should().Be(ratingFill);
492+
ratingView.FillWhenTapped.Should().NotBe(ratingFill);
493+
ratingView.FillWhenTapped = ratingFill;
494+
ratingView.FillWhenTapped.Should().Be(ratingFill);
495495
}
496496

497497
[Theory]
@@ -752,7 +752,7 @@ public void ViewStructure_ItemFill_Colors()
752752
{
753753
Rating = 0,
754754
MaximumRating = 3,
755-
RatingViewTapFill = RatingViewTapFill.Background,
755+
FillWhenTapped = FillWhenTapped.Background,
756756
FilledShapeColor = filledShapeColor,
757757
EmptyShapeColor = emptyShapeColor,
758758
BackgroundColor = backgroundColor
@@ -800,7 +800,7 @@ public void ViewStructure_ShapeFill_Colors()
800800
{
801801
Rating = 1.5,
802802
MaximumRating = 3,
803-
RatingViewTapFill = RatingViewTapFill.Shape,
803+
FillWhenTapped = FillWhenTapped.Shape,
804804
FilledShapeColor = filledShapeColor,
805805
EmptyShapeColor = emptyShapeColor
806806
};

src/CommunityToolkit.Maui/Views/RatingView/RatingView.shared.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public partial class RatingView : TemplatedView, IRatingView
4141
/// <summary>The backing store for the <see cref="MaximumRating" /> bindable property.</summary>
4242
public static readonly BindableProperty MaximumRatingProperty = BindableProperty.Create(nameof(MaximumRating), typeof(int), typeof(RatingView), defaultValue: RatingViewDefaults.MaximumRating, validateValue: IsMaximumRatingValid, propertyChanged: OnMaximumRatingChange);
4343

44-
/// <summary>The backing store for the <see cref="RatingViewTapFill" /> bindable property.</summary>
45-
public static readonly BindableProperty RatingViewTapFillProperty = BindableProperty.Create(nameof(RatingViewTapFill), typeof(RatingViewTapFill), typeof(RatingView), defaultValue: RatingViewTapFill.Shape, propertyChanged: OnRatingColorChanged);
44+
/// <summary>The backing store for the <see cref="FillWhenTapped" /> bindable property.</summary>
45+
public static readonly BindableProperty FillWhenTappedProperty = BindableProperty.Create(nameof(FillWhenTapped), typeof(FillWhenTapped), typeof(RatingView), defaultValue: Core.FillWhenTapped.Shape, propertyChanged: OnRatingColorChanged);
4646

4747
/// <summary>The backing store for the <see cref="Rating" /> bindable property.</summary>
4848
public static readonly BindableProperty RatingProperty = BindableProperty.Create(nameof(Rating), typeof(double), typeof(RatingView), defaultValue: RatingViewDefaults.DefaultRating, validateValue: IsRatingValid, propertyChanged: OnRatingChanged);
@@ -154,11 +154,11 @@ public double Rating
154154
}
155155
}
156156

157-
/// <summary>RatingView selection determining which element of the RatingView Shape to fill when tapped.</summary>
158-
public RatingViewTapFill RatingViewTapFill
157+
/// <summary>Gets or sets the element to fill when a shape is tapped.</summary>
158+
public FillWhenTapped FillWhenTapped
159159
{
160-
get => (RatingViewTapFill)GetValue(RatingViewTapFillProperty);
161-
set => SetValue(RatingViewTapFillProperty, value);
160+
get => (FillWhenTapped)GetValue(FillWhenTappedProperty);
161+
set => SetValue(FillWhenTappedProperty, value);
162162
}
163163

164164
/// <inheritdoc />
@@ -287,7 +287,7 @@ static void OnMaximumRatingChange(BindableObject bindable, object oldValue, obje
287287
layout.RemoveAt(lastElement);
288288
}
289289

290-
ratingView.UpdateShapeFills(ratingView.RatingViewTapFill);
290+
ratingView.UpdateShapeFills(ratingView.FillWhenTapped);
291291

292292
}
293293
else if (newMaximumRatingValue > oldMaximumRatingValue)
@@ -306,7 +306,7 @@ static void OnRatingChanged(BindableObject bindable, object oldValue, object new
306306
var ratingView = (RatingView)bindable;
307307
var newRating = (double)newValue;
308308

309-
ratingView.UpdateShapeFills(ratingView.RatingViewTapFill);
309+
ratingView.UpdateShapeFills(ratingView.FillWhenTapped);
310310
ratingView.OnRatingChangedEvent(new RatingChangedEventArgs(newRating));
311311
}
312312

@@ -319,7 +319,7 @@ static void OnSpacingChanged(BindableObject bindable, object oldValue, object ne
319319
static void OnRatingColorChanged(BindableObject bindable, object oldValue, object newValue)
320320
{
321321
var ratingView = (RatingView)bindable;
322-
ratingView.UpdateShapeFills(ratingView.RatingViewTapFill);
322+
ratingView.UpdateShapeFills(ratingView.FillWhenTapped);
323323
}
324324

325325
static LinearGradientBrush GetPartialFillBrush(Color filledColor, double partialFill, Color emptyColor)
@@ -437,7 +437,7 @@ void AddChildrenToLayout(int minimumRating, int maximumRating)
437437
RatingLayout.Children.Add(child);
438438
}
439439

440-
UpdateShapeFills(RatingViewTapFill);
440+
UpdateShapeFills(FillWhenTapped);
441441
}
442442

443443
void ChangeShape(string shape)
@@ -476,9 +476,9 @@ void OnShapeTapped(object? sender, TappedEventArgs? e)
476476
: GetRatingWhenMaximumRatingEqualsOne(Rating);
477477
}
478478

479-
void UpdateShapeFills(RatingViewTapFill ratingViewTapFill)
479+
void UpdateShapeFills(FillWhenTapped fillWhenTapped)
480480
{
481-
var isShapeFill = ratingViewTapFill is RatingViewTapFill.Shape;
481+
var isShapeFill = fillWhenTapped is FillWhenTapped.Shape;
482482
var visualElements = GetVisualTreeDescendantsWithBorderAndShape((VisualElement)RatingLayout.GetVisualTreeDescendants()[0], isShapeFill);
483483
if (isShapeFill)
484484
{

0 commit comments

Comments
 (0)