RadRating
Represents a rating control that allows users to provide feedback by selecting a value from a range of visual rating items (typically stars).
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadRating : RadControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadRating...
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadRating class. Sets up the control with default settings, makes it selectable for keyboard input, and wires the necessary events.
public RadRating()
Properties
Gets or sets a value indicating whether the rating control automatically adjusts its size based on its content. When enabled, the control will resize itself to accommodate the rating items and layout requirements.
[Browsable(true)]
public override bool AutoSize { get; set; }
true if the control should automatically size itself; otherwise, false. The default is false.
Overrides:
Gets or sets the text displayed in the caption label of the rating control. This text typically serves as a title or header for the rating interface.
[Browsable(true)]
public string Caption { get; set; }
A string representing the caption text. The default value is an empty string.
Gets the default size for the rating control when no explicit size is specified. This size provides appropriate dimensions for displaying rating items with good visibility.
protected override Size DefaultSize { get; }
A Size structure with default dimensions of 249x56 pixels.
Overrides:
Gets or sets the text displayed in the description label of the rating control. This text typically provides detailed information or instructions about the rating functionality.
[Browsable(true)]
public string Description { get; set; }
A string representing the description text. The default value is an empty string.
Gets or sets the direction in which the rating items are painted and evaluated. This determines whether the rating starts from the beginning (Standard) or from the end (Reversed) of the item collection.
[Browsable(true)]
public virtual RatingDirection Direction { get; set; }
A RatingDirection value that specifies the painting direction. The default is Standard.
Gets the collection of rating items that make up the visual representation of the rating control. This collection contains the individual visual elements (such as stars) that users interact with to provide ratings. Items can be added, removed, or modified to customize the rating interface.
[Browsable(true)]
[Bindable(true)]
public RadItemOwnerCollection Items { get; }
A RadItemOwnerCollection containing the rating visual elements.
Gets or sets the maximum value that can be assigned to the rating control. This property defines the upper bound of the rating range and affects how the rating items are interpreted.
[Browsable(true)]
public double Maximum { get; set; }
A double value representing the maximum rating. The default value is 100.0.
Gets or sets the minimum value that can be assigned to the rating control. This property defines the lower bound of the rating range and affects how the rating items are interpreted.
[Browsable(true)]
public double Minimum { get; set; }
A double value representing the minimum rating. The default value is 0.0.
Gets or sets the orientation of the rating control, determining whether rating items are arranged horizontally or vertically. This affects both the visual layout and the interaction behavior of the rating items.
[Browsable(true)]
public Orientation Orientation { get; set; }
An Orientation value that specifies the layout orientation. The default is Horizontal.
Gets the instance of RadRatingElement that provides the core functionality for this rating control. This element contains the visual styling, interaction logic, and rating calculation algorithms. The element encapsulates all the actual functionality while the control serves as a wrapper for Windows Forms integration.
[Browsable(false)]
public RadRatingElement RatingElement { get; }
A RadRatingElement that represents the rating control's core element.
Gets or sets a value indicating whether the rating control is in read-only mode. When read-only, users cannot interact with the rating items to change the value, but the value can still be set programmatically. This is useful for displaying ratings without allowing user modification.
[Browsable(true)]
public bool ReadOnly { get; set; }
true if the rating control is read-only; otherwise, false. The default value is false.
Gets or sets the selection mode that determines how the rating value is calculated when users interact with rating items. This affects the precision and behavior of value selection during user interactions.
[Browsable(true)]
public RatingSelectionMode SelectionMode { get; set; }
A RatingSelectionMode value that specifies the selection behavior. The default is Precise.
Gets or sets the text displayed in the sub-caption label of the rating control. This text typically provides additional information or context below the main caption.
[Browsable(true)]
public string Subcaption { get; set; }
A string representing the sub-caption text. The default value is an empty string.
Gets or sets the current rating value as a nullable double. This property represents the user's selected rating within the range defined by Minimum and Maximum properties. A null value indicates that no rating has been selected.
[Browsable(true)]
public double? Value { get; set; }
A nullable double representing the current rating value, or null if no rating is selected.
Methods
Determines whether this control defines the theme for the specified element. This method is used by the theming system to establish which control is responsible for providing theme information to elements in the visual hierarchy.
public override bool ControlDefinesThemeForElement(RadElement element)
The RadElement to check for theme definition responsibility.
Returns:true if this control defines the theme for the specified element; otherwise, false.
Overrides:
Creates the child items for the rating control by instantiating and adding the rating element to the root element. This method is called during control initialization to set up the visual hierarchy.
protected override void CreateChildItems(RadElement parent)
The parent RadElement that will contain the child items.
Overrides:
Releases the unmanaged resources used by the RadRating and optionally releases the managed resources. This method unwires events and performs cleanup operations before calling the base disposal method.
protected override void Dispose(bool disposing)
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Overrides:
Creates and returns the rating element that provides the core functionality for the rating control. This method can be overridden in derived classes to provide custom rating element implementations.
protected virtual RadRatingElement GetRatingElement()
A new instance of RadRatingElement that will handle the rating functionality.
Raises the ValueChanged event with the specified event arguments. This method is called when the rating value has been successfully changed to notify any registered event handlers.
Raises the ValueChanging event with the specified event arguments. This method is called before a value change occurs, allowing handlers to validate or cancel the change.
protected virtual void OnValueChanging(ValueChangingEventArgs e)
A ValueChangingEventArgs that contains the event data and allows cancellation of the change.
Unwires the event handlers from the underlying rating element. This method disconnects event handlers to prevent memory leaks and ensure proper cleanup when the control is disposed.
protected virtual void UnwireEvents()
Wires the necessary event handlers to the underlying rating element. This method establishes connections between the rating element's events and the control's event handlers to enable proper event propagation and functionality.
protected virtual void WireEvents()
Events
Occurs after the value of the rating control has been changed through user interaction or programmatic assignment. This event is fired after the value change is complete and all related processing has been finished.
[Browsable(true)]
public event EventHandler ValueChanged
Occurs before the value of the rating control is changed, providing an opportunity to cancel the change. This cancelable event allows validation or conditional approval of value changes before they are applied.
public event ValueChangingEventHandler ValueChanging