Class RatingControl
A Rating Control with support to various shapes or precision levels.
public class RatingControl : TemplatedControl, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTemplatedControlRatingControl
- Implements
-
IDataContextProviderILogicalIThemeVariantHostIResourceHostIResourceNodeIStyleHostISetLogicalParentISetInheritanceParentIStyleableINamedIInputElementIDataTemplateHostISetterValue
- Inherited Members
-
TemplatedControl.BackgroundPropertyTemplatedControl.BackgroundSizingPropertyTemplatedControl.BorderBrushPropertyTemplatedControl.BorderThicknessPropertyTemplatedControl.CornerRadiusPropertyTemplatedControl.FontFamilyPropertyTemplatedControl.FontFeaturesPropertyTemplatedControl.FontSizePropertyTemplatedControl.FontStylePropertyTemplatedControl.FontWeightPropertyTemplatedControl.FontStretchPropertyTemplatedControl.ForegroundPropertyTemplatedControl.PaddingPropertyTemplatedControl.TemplatePropertyTemplatedControl.IsTemplateFocusTargetPropertyTemplatedControl.TemplateAppliedEventTemplatedControl.GetIsTemplateFocusTarget(Control)TemplatedControl.ApplyTemplate()TemplatedControl.GetTemplateFocusTarget()TemplatedControl.OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)TemplatedControl.OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)TemplatedControl.OnTemplateChanged(AvaloniaPropertyChangedEventArgs)TemplatedControl.BackgroundTemplatedControl.BackgroundSizingTemplatedControl.BorderBrushTemplatedControl.BorderThicknessTemplatedControl.CornerRadiusTemplatedControl.FontFamilyTemplatedControl.FontFeaturesTemplatedControl.FontSizeTemplatedControl.FontStyleTemplatedControl.FontWeightTemplatedControl.FontStretchTemplatedControl.ForegroundTemplatedControl.PaddingTemplatedControl.TemplateTemplatedControl.TemplateAppliedControl.FocusAdornerPropertyControl.TagPropertyControl.ContextMenuPropertyControl.ContextFlyoutPropertyControl.RequestBringIntoViewEventControl.ContextRequestedEventControl.LoadedEventControl.UnloadedEventControl.SizeChangedEventControl.OnLoaded(RoutedEventArgs)Control.OnUnloaded(RoutedEventArgs)Control.OnSizeChanged(SizeChangedEventArgs)Control.OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnGotFocus(GotFocusEventArgs)Control.OnLostFocus(RoutedEventArgs)Control.OnCreateAutomationPeer()Control.OnKeyUp(KeyEventArgs)Control.OnPropertyChanged(AvaloniaPropertyChangedEventArgs)Control.FocusAdornerControl.DataTemplatesControl.ContextMenuControl.ContextFlyoutControl.IsLoadedControl.TagControl.ContextRequestedControl.LoadedControl.UnloadedControl.SizeChangedInputElement.FocusablePropertyInputElement.IsEnabledPropertyInputElement.IsEffectivelyEnabledPropertyInputElement.CursorPropertyInputElement.IsKeyboardFocusWithinPropertyInputElement.IsFocusedPropertyInputElement.IsHitTestVisiblePropertyInputElement.IsPointerOverPropertyInputElement.IsTabStopPropertyInputElement.GotFocusEventInputElement.LostFocusEventInputElement.KeyDownEventInputElement.KeyUpEventInputElement.TabIndexPropertyInputElement.TextInputEventInputElement.TextInputMethodClientRequestedEventInputElement.PointerEnteredEventInputElement.PointerExitedEventInputElement.PointerMovedEventInputElement.PointerPressedEventInputElement.PointerReleasedEventInputElement.PointerCaptureLostEventInputElement.PointerWheelChangedEventInputElement.TappedEventInputElement.HoldingEventInputElement.DoubleTappedEventInputElement.Focus(NavigationMethod, KeyModifiers)InputElement.OnAccessKey(RoutedEventArgs)InputElement.OnTextInput(TextInputEventArgs)InputElement.OnPointerCaptureLost(PointerCaptureLostEventArgs)InputElement.OnPointerWheelChanged(PointerWheelEventArgs)InputElement.UpdateIsEffectivelyEnabled()InputElement.FocusableInputElement.IsEnabledInputElement.CursorInputElement.IsKeyboardFocusWithinInputElement.IsFocusedInputElement.IsHitTestVisibleInputElement.IsPointerOverInputElement.IsTabStopInputElement.IsEffectivelyEnabledInputElement.TabIndexInputElement.KeyBindingsInputElement.IsEnabledCoreInputElement.GestureRecognizersInputElement.GotFocusInputElement.LostFocusInputElement.KeyDownInputElement.KeyUpInputElement.TextInputInputElement.TextInputMethodClientRequestedInputElement.PointerEnteredInputElement.PointerExitedInputElement.PointerMovedInputElement.PointerPressedInputElement.PointerReleasedInputElement.PointerCaptureLostInputElement.PointerWheelChangedInputElement.TappedInputElement.HoldingInputElement.DoubleTappedInteractive.RaiseEvent(RoutedEventArgs)Interactive.BuildEventRoute(RoutedEvent)Layoutable.DesiredSizePropertyLayoutable.WidthPropertyLayoutable.HeightPropertyLayoutable.MinWidthPropertyLayoutable.MaxWidthPropertyLayoutable.MinHeightPropertyLayoutable.MaxHeightPropertyLayoutable.MarginPropertyLayoutable.HorizontalAlignmentPropertyLayoutable.VerticalAlignmentPropertyLayoutable.UseLayoutRoundingPropertyLayoutable.UpdateLayout()Layoutable.Measure(Size)Layoutable.Arrange(Rect)Layoutable.InvalidateMeasure()Layoutable.InvalidateArrange()Layoutable.AffectsMeasure<T>(params AvaloniaProperty[])Layoutable.AffectsArrange<T>(params AvaloniaProperty[])Layoutable.MeasureCore(Size)Layoutable.MeasureOverride(Size)Layoutable.ArrangeCore(Rect)Layoutable.ArrangeOverride(Size)Layoutable.OnMeasureInvalidated()Layoutable.OnVisualParentChanged(Visual, Visual)Layoutable.WidthLayoutable.HeightLayoutable.MinWidthLayoutable.MaxWidthLayoutable.MinHeightLayoutable.MaxHeightLayoutable.MarginLayoutable.HorizontalAlignmentLayoutable.VerticalAlignmentLayoutable.DesiredSizeLayoutable.IsMeasureValidLayoutable.IsArrangeValidLayoutable.UseLayoutRoundingLayoutable.EffectiveViewportChangedLayoutable.LayoutUpdatedVisual.BoundsPropertyVisual.ClipToBoundsPropertyVisual.ClipPropertyVisual.IsVisiblePropertyVisual.OpacityPropertyVisual.OpacityMaskPropertyVisual.EffectPropertyVisual.HasMirrorTransformPropertyVisual.RenderTransformPropertyVisual.RenderTransformOriginPropertyVisual.FlowDirectionPropertyVisual.VisualParentPropertyVisual.ZIndexPropertyVisual.GetFlowDirection(Visual)Visual.SetFlowDirection(Visual, FlowDirection)Visual.InvalidateVisual()Visual.Render(DrawingContext)Visual.AffectsRender<T>(params AvaloniaProperty[])Visual.OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)Visual.OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)Visual.InvalidateMirrorTransform()Visual.BoundsVisual.ClipToBoundsVisual.ClipVisual.IsEffectivelyVisibleVisual.IsVisibleVisual.OpacityVisual.OpacityMaskVisual.EffectVisual.HasMirrorTransformVisual.RenderTransformVisual.RenderTransformOriginVisual.FlowDirectionVisual.ZIndexVisual.VisualChildrenVisual.VisualRootVisual.BypassFlowDirectionPoliciesVisual.AttachedToVisualTreeVisual.DetachedFromVisualTreeStyledElement.DataContextPropertyStyledElement.NamePropertyStyledElement.ParentPropertyStyledElement.TemplatedParentPropertyStyledElement.ThemePropertyStyledElement.BeginInit()StyledElement.EndInit()StyledElement.ApplyStyling()StyledElement.InitializeIfNeeded()StyledElement.OnDataContextBeginUpdate()StyledElement.OnDataContextEndUpdate()StyledElement.OnInitialized()StyledElement.NameStyledElement.ClassesStyledElement.DataContextStyledElement.IsInitializedStyledElement.StylesStyledElement.StyleKeyStyledElement.ResourcesStyledElement.TemplatedParentStyledElement.ThemeStyledElement.LogicalChildrenStyledElement.PseudoClassesStyledElement.StyleKeyOverrideStyledElement.ParentStyledElement.ActualThemeVariantStyledElement.AttachedToLogicalTreeStyledElement.DetachedFromLogicalTreeStyledElement.DataContextChangedStyledElement.InitializedStyledElement.ResourcesChangedStyledElement.ActualThemeVariantChangedAnimatable.TransitionsPropertyAnimatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)Animatable.TransitionsAvaloniaObject.CheckAccess()AvaloniaObject.VerifyAccess()AvaloniaObject.ClearValue(AvaloniaProperty)AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)AvaloniaObject.ClearValue<T>(StyledProperty<T>)AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetHashCode()AvaloniaObject.GetValue(AvaloniaProperty)AvaloniaObject.GetValue<T>(StyledProperty<T>)AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)AvaloniaObject.IsAnimating(AvaloniaProperty)AvaloniaObject.IsSet(AvaloniaProperty)AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)AvaloniaObject.Bind(AvaloniaProperty, IBinding)AvaloniaObject.CoerceValue(AvaloniaProperty)AvaloniaObject.RaisePropertyChanged<T>(DirectPropertyBase<T>, T, T)AvaloniaObject.SetAndRaise<T>(DirectPropertyBase<T>, ref T, T)AvaloniaObject.InheritanceParentAvaloniaObject.this[AvaloniaProperty]AvaloniaObject.this[IndexerDescriptor]AvaloniaObject.PropertyChanged
Fields
CustomGeometryProperty
Defines the CustomGeometry property.
public static readonly StyledProperty<Geometry?> CustomGeometryProperty
Field Value
- StyledProperty<Geometry>
IsReadOnlyProperty
Defines the IsReadOnly property.
public static readonly StyledProperty<bool> IsReadOnlyProperty
Field Value
- StyledProperty<bool>
ItemCountProperty
Defines the ItemCount property.
public static readonly StyledProperty<int> ItemCountProperty
Field Value
- StyledProperty<int>
ItemSizeProperty
Defines the ItemSize property.
public static readonly StyledProperty<double> ItemSizeProperty
Field Value
- StyledProperty<double>
ItemSpacingProperty
Defines the ItemSpacing property.
public static readonly StyledProperty<double> ItemSpacingProperty
Field Value
- StyledProperty<double>
OrientationProperty
Defines the Orientation property.
public static readonly StyledProperty<Orientation> OrientationProperty
Field Value
- StyledProperty<Orientation>
PrecisionProperty
Defines the Precision property.
public static readonly StyledProperty<RatingPrecision> PrecisionProperty
Field Value
- StyledProperty<RatingPrecision>
PreviewFillProperty
Defines the PreviewFill property.
public static readonly StyledProperty<IBrush?> PreviewFillProperty
Field Value
- StyledProperty<IBrush>
PreviewStrokeProperty
Defines the PreviewStroke property.
public static readonly StyledProperty<IBrush?> PreviewStrokeProperty
Field Value
- StyledProperty<IBrush>
RatedFillProperty
Defines the RatedFill property.
public static readonly StyledProperty<IBrush?> RatedFillProperty
Field Value
- StyledProperty<IBrush>
RatedStrokeProperty
Defines the RatedStroke property.
public static readonly StyledProperty<IBrush?> RatedStrokeProperty
Field Value
- StyledProperty<IBrush>
ShapeProperty
Defines the Shape property.
public static readonly StyledProperty<RatingShape> ShapeProperty
Field Value
- StyledProperty<RatingShape>
StrokeThicknessProperty
Defines the StrokeThickness property.
public static readonly StyledProperty<double> StrokeThicknessProperty
Field Value
- StyledProperty<double>
UnratedFillProperty
Defines the UnratedFill property.
public static readonly StyledProperty<IBrush?> UnratedFillProperty
Field Value
- StyledProperty<IBrush>
UnratedStrokeProperty
Defines the UnratedStroke property.
public static readonly StyledProperty<IBrush?> UnratedStrokeProperty
Field Value
- StyledProperty<IBrush>
ValueChangedEvent
Defines the ValueChanged routed event.
public static readonly RoutedEvent<RoutedEventArgs> ValueChangedEvent
Field Value
- RoutedEvent<RoutedEventArgs>
ValueProperty
Defines the Value property.
public static readonly StyledProperty<double> ValueProperty
Field Value
- StyledProperty<double>
Properties
CustomGeometry
Gets or sets the custom geometry to use when Shape is set to Custom.
public Geometry? CustomGeometry { get; set; }
Property Value
- Geometry
IsReadOnly
Gets or sets a value indicating whether the control is read-only.
public bool IsReadOnly { get; set; }
Property Value
ItemCount
Gets or sets the number of items (stars, hearts, etc.) to display.
public int ItemCount { get; set; }
Property Value
ItemSize
Gets or sets the size of each rating item.
public double ItemSize { get; set; }
Property Value
ItemSpacing
Gets or sets the spacing between rating items.
public double ItemSpacing { get; set; }
Property Value
Orientation
Gets or sets the orientation of the rating items (Horizontal or Vertical).
public Orientation Orientation { get; set; }
Property Value
- Orientation
Precision
Gets or sets the precision of the rating (Full, Half, or Exact).
public RatingPrecision Precision { get; set; }
Property Value
PreviewFill
Gets or sets the fill brush used when hovering over items.
public IBrush? PreviewFill { get; set; }
Property Value
- IBrush
PreviewStroke
Gets or sets the stroke brush used when hovering over items.
public IBrush? PreviewStroke { get; set; }
Property Value
- IBrush
RatedFill
Gets or sets the fill brush for rated items (active state).
public IBrush? RatedFill { get; set; }
Property Value
- IBrush
RatedStroke
Gets or sets the stroke brush for rated items.
public IBrush? RatedStroke { get; set; }
Property Value
- IBrush
Shape
Gets or sets the shape of the rating items.
public RatingShape Shape { get; set; }
Property Value
StrokeThickness
Gets or sets the thickness of the stroke for items.
public double StrokeThickness { get; set; }
Property Value
UnratedFill
Gets or sets the fill brush for unrated items (inactive state).
public IBrush? UnratedFill { get; set; }
Property Value
- IBrush
UnratedStroke
Gets or sets the stroke brush for unrated items.
public IBrush? UnratedStroke { get; set; }
Property Value
- IBrush
Value
Gets or sets the current value of the rating.
public double Value { get; set; }
Property Value
Methods
OnApplyTemplate(TemplateAppliedEventArgs)
Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
Parameters
eTemplateAppliedEventArgsThe event args.
OnKeyDown(KeyEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.KeyDownEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnKeyDown(KeyEventArgs e)
Parameters
eKeyEventArgsData about the event.
OnPointerEntered(PointerEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.PointerEnteredEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPointerEntered(PointerEventArgs e)
Parameters
ePointerEventArgsData about the event.
OnPointerExited(PointerEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.PointerExitedEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPointerExited(PointerEventArgs e)
Parameters
ePointerEventArgsData about the event.
OnPointerMoved(PointerEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.PointerMovedEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPointerMoved(PointerEventArgs e)
Parameters
ePointerEventArgsData about the event.
OnPointerPressed(PointerPressedEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.PointerPressedEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPointerPressed(PointerPressedEventArgs e)
Parameters
ePointerPressedEventArgsData about the event.
OnPointerReleased(PointerReleasedEventArgs)
Invoked when an unhandled Avalonia.Input.InputElement.PointerReleasedEvent reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPointerReleased(PointerReleasedEventArgs e)
Parameters
ePointerReleasedEventArgsData about the event.
Events
ValueChanged
Occurs when the Value property changes.
public event EventHandler<RoutedEventArgs>? ValueChanged
Event Type
- EventHandler<RoutedEventArgs>