Class RadRating
Represents a rating control that allows users to provide feedback by selecting a value from a range of visual rating items (typically stars).
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadRating : RadControl, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider
Constructors
RadRating()
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.
Declaration
public RadRating()
Properties
AutoSize
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.
Declaration
public override bool AutoSize { get; set; }
Property Value
System.Boolean
true if the control should automatically size itself; otherwise, false. The default is false. |
Overrides
Caption
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.
Declaration
public string Caption { get; set; }
Property Value
System.String
A string representing the caption text. The default value is an empty string. |
DefaultSize
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.
Declaration
protected override Size DefaultSize { get; }
Property Value
System.Drawing.Size
A System.Drawing.Size structure with default dimensions of 249x56 pixels. |
Description
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.
Declaration
public string Description { get; set; }
Property Value
System.String
A string representing the description text. The default value is an empty string. |
Direction
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.
Declaration
public virtual RatingDirection Direction { get; set; }
Property Value
RatingDirection
A RatingDirection value that specifies the painting direction. The default is Standard. |
Items
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.
Declaration
public RadItemOwnerCollection Items { get; }
Property Value
RadItemOwnerCollection
A RadItemOwnerCollection containing the rating visual elements. |
Maximum
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.
Declaration
public double Maximum { get; set; }
Property Value
System.Double
A double value representing the maximum rating. The default value is 100.0. |
Minimum
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.
Declaration
public double Minimum { get; set; }
Property Value
System.Double
A double value representing the minimum rating. The default value is 0.0. |
Orientation
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.
Declaration
public Orientation Orientation { get; set; }
Property Value
System.Windows.Forms.Orientation
An Orientation value that specifies the layout orientation. The default is System.Windows.Forms.Orientation.Horizontal. |
RatingElement
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.
Declaration
public RadRatingElement RatingElement { get; }
Property Value
RadRatingElement
A RadRatingElement that represents the rating control's core element. |
ReadOnly
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.
Declaration
public bool ReadOnly { get; set; }
Property Value
System.Boolean
true if the rating control is read-only; otherwise, false. The default value is false. |
SelectionMode
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.
Declaration
public RatingSelectionMode SelectionMode { get; set; }
Property Value
RatingSelectionMode
A RatingSelectionMode value that specifies the selection behavior. The default is Precise. |
Subcaption
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.
Declaration
public string Subcaption { get; set; }
Property Value
System.String
A string representing the sub-caption text. The default value is an empty string. |
Text
This property is not relevant for this class.
Declaration
public override string Text { get; set; }
Property Value
System.String
|
Overrides
Value
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.
Declaration
public double? Value { get; set; }
Property Value
System.Nullable<System.Double>
A nullable double representing the current rating value, or null if no rating is selected. |
Methods
ControlDefinesThemeForElement(RadElement)
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.
Declaration
public override bool ControlDefinesThemeForElement(RadElement element)
Parameters
RadElement
element
The RadElement to check for theme definition responsibility. |
Returns
System.Boolean
true if this control defines the theme for the specified element; otherwise, false. |
Overrides
CreateChildItems(RadElement)
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.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
RadElement
parent
The parent RadElement that will contain the child items. |
Overrides
Dispose(Boolean)
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.
Declaration
protected override void Dispose(bool disposing)
Parameters
System.Boolean
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
GetRatingElement()
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.
Declaration
protected virtual RadRatingElement GetRatingElement()
Returns
RadRatingElement
A new instance of RadRatingElement that will handle the rating functionality. |
OnValueChanged(EventArgs)
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.
Declaration
protected virtual void OnValueChanged(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs that contains the event data. |
OnValueChanging(ValueChangingEventArgs)
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.
Declaration
protected virtual void OnValueChanging(ValueChangingEventArgs e)
Parameters
ValueChangingEventArgs
e
A ValueChangingEventArgs that contains the event data and allows cancellation of the change. |
UnwireEvents()
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.
Declaration
protected virtual void UnwireEvents()
WireEvents()
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.
Declaration
protected virtual void WireEvents()
Events
ValueChanged
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.
Declaration
public event EventHandler ValueChanged
Event Type
System.EventHandler
|
ValueChanging
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.
Declaration
public event ValueChangingEventHandler ValueChanging
Event Type
ValueChangingEventHandler
|