Loading...
Loading...
Implements the Syncfusion WPF SfRating control for star-based rating input. Use when adding user feedback or review ratings, configuring rating precision (standard/half/exact), or presenting read-only rating displays.
npx skill4agent add syncfusion/wpf-ui-components-skills syncfusion-wpf-rating<Window xmlns:syncfusion="http://schemas.syncfusion.com/wpf">
<Grid>
<syncfusion:SfRating ItemsCount="5"
Value="3"
Width="150"/>
</Grid>
</Window>using Syncfusion.Windows.Controls.Input;
namespace RatingApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
SfRating rating = new SfRating()
{
ItemsCount = 5,
Value = 3,
Width = 150
};
this.Content = rating;
}
}
}<syncfusion:SfRating ItemsCount="5"
Value="3"
Width="150"
ValueChanged="SfRating_ValueChanged"/>private void SfRating_ValueChanged(object sender, ValueChangedEventArgs e)
{
double oldValue = e.OldValue;
double newValue = e.NewValue;
MessageBox.Show($"Rating changed from {oldValue} to {newValue}");
}<syncfusion:SfRating ItemsCount="5"
Precision="Half"
Value="3.5"
Width="150"/><syncfusion:SfRating ItemsCount="5" Value="4" Width="150">
<syncfusion:SfRating.ItemContainerStyle>
<Style TargetType="syncfusion:SfRatingItem">
<Setter Property="RatedFill" Value="Gold"/>
<Setter Property="UnratedFill" Value="LightGray"/>
<Setter Property="RatedStroke" Value="Orange"/>
<Setter Property="RatedStrokeThickness" Value="2"/>
</Style>
</syncfusion:SfRating.ItemContainerStyle>
</syncfusion:SfRating><syncfusion:SfRating ItemsCount="5"
Value="4.5"
Precision="Half"
IsReadOnly="True"
Width="150"/><syncfusion:SfRating ItemsCount="5"
Value="3"
ItemSize="30"
ItemsSpacing="10"
Width="200"/><syncfusion:SfRating ItemsCount="5"
Value="3"
Precision="Exact"
ShowToolTip="True"
AutoToolTipPrecision="2"
ToolTipForeground="DarkBlue"
Width="150"/>| Property | Type | Description |
|---|---|---|
| int | Number of rating items to display (e.g., 5 stars) |
| double | Current rating value (0 to ItemsCount) |
| Precision | Rating accuracy: Standard, Half, or Exact |
| bool | Makes rating non-editable when true |
| bool | Shows/hides tooltip on hover (default: true) |
| int | Decimal places in tooltip (default: 1) |
| double | Size of each rating item (default: 20) |
| double | Space between items (default: 4) |
| CornerRadius | Corner radius for rating items |
| double | Read-only preview value on hover |
| Property | Description |
|---|---|
| Fill color for selected/rated items |
| Fill color for unselected items |
| Stroke color for rated items |
| Stroke color for unrated items |
| Stroke thickness for rated items |
| Stroke thickness for unrated items |
| Fill color on mouse hover |
| Stroke color on mouse hover |
| Stroke thickness on hover |
| Individual item height |
Syncfusion.SfInput.WPFSyncfusion.SfShared.WPFSyncfusion.SfInput.WPF