Skip to content

You can use the Rate control when displaying reviews or performing quick grading operations on things.

cs
[DefaultProperty("Items")]
[ContentProperty("Items")]
[TemplatePart(Name = ElementPanel, Type = typeof(Panel))]
public class SimpleItemsControl : Control
cs
public class RegularItemsControl : SimpleItemsControl
cs
public class Rate : RegularItemsControl

Attributes ​

PropertyDescriptionDefault ValueRemarks
AllowHalfWhether to allow half selectionfalse
AllowClearWhether to allow clear after clicking againtrue
IconIcon
Countstar Total number5
DefaultValueDefault Value0
ValueCurrent Rating0
TextScore text
ShowTextWhether to display the score textfalse
IsReadOnlyIs it read-onlyfalse
ValueCurrent Rating0

Events ​

NameDescription
ValueChangedTriggered when the score changes

Case ​

xml
<StackPanel Width="170">
    <hc:Rate Value="2"/>
    <hc:Rate Value="5" Count="6" Margin="0,16,0,0" Foreground="{DynamicResource SuccessBrush}"/>
    <hc:Rate DefaultValue="3" IsReadOnly="True" AllowHalf="True" Margin="0,16,0,0" Foreground="{DynamicResource WarningBrush}"/>
    <hc:Rate DefaultValue="1" AllowClear="False" AllowHalf="True" Margin="0,16,0,0" Foreground="{DynamicResource DangerBrush}" Icon="{StaticResource LoveGeometry}"/>
    <hc:Rate Value="4.5" AllowHalf="True" ShowText="True" Margin="0,16,0,0" Foreground="{DynamicResource DangerBrush}" Icon="{StaticResource LoveGeometry}"/>
</StackPanel>

Rate

Released under the MIT License.