Class Shape
public abstract class Shape : Control, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
- Inheritance
-
Shape
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Shape()
protected Shape()
Fields
FillProperty
Defines the Fill property.
public static readonly StyledProperty<IBrush?> FillProperty
Field Value
StretchProperty
Defines the Stretch property.
public static readonly StyledProperty<Stretch> StretchProperty
Field Value
StrokeDashArrayProperty
Defines the StrokeDashArray property.
public static readonly StyledProperty<AvaloniaList<double>?> StrokeDashArrayProperty
Field Value
StrokeDashOffsetProperty
Defines the StrokeDashOffset property.
public static readonly StyledProperty<double> StrokeDashOffsetProperty
Field Value
StrokeJoinProperty
Defines the StrokeJoin property.
public static readonly StyledProperty<PenLineJoin> StrokeJoinProperty
Field Value
StrokeLineCapProperty
Defines the StrokeLineCap property.
public static readonly StyledProperty<PenLineCap> StrokeLineCapProperty
Field Value
StrokeProperty
Defines the Stroke property.
public static readonly StyledProperty<IBrush?> StrokeProperty
Field Value
StrokeThicknessProperty
Defines the StrokeThickness property.
public static readonly StyledProperty<double> StrokeThicknessProperty
Field Value
Properties
DefiningGeometry
Gets a value that represents the Geometry of the shape.
public Geometry? DefiningGeometry { get; }
Property Value
Fill
Gets or sets the IBrush that specifies how the shape's interior is painted.
public IBrush? Fill { get; set; }
Property Value
RenderedGeometry
Gets a value that represents the final rendered Geometry of the shape.
public Geometry? RenderedGeometry { get; }
Property Value
Stretch
Gets or sets a Stretch enumeration value that describes how the shape fills its allocated space.
public Stretch Stretch { get; set; }
Property Value
Stroke
Gets or sets the IBrush that specifies how the shape's outline is painted.
public IBrush? Stroke { get; set; }
Property Value
StrokeDashArray
Gets or sets a collection of double values that indicate the pattern of dashes and gaps that is used to outline shapes.
public AvaloniaList<double>? StrokeDashArray { get; set; }
Property Value
StrokeDashOffset
Gets or sets a value that specifies the distance within the dash pattern where a dash begins.
public double StrokeDashOffset { get; set; }
Property Value
StrokeJoin
Gets or sets a PenLineJoin enumeration value that specifies the type of join that is used at the vertices of a Shape.
public PenLineJoin StrokeJoin { get; set; }
Property Value
StrokeLineCap
Gets or sets a PenLineCap enumeration value that describes the shape at the ends of a line.
public PenLineCap StrokeLineCap { get; set; }
Property Value
StrokeThickness
Gets or sets the width of the shape outline.
public double StrokeThickness { get; set; }
Property Value
Methods
AffectsGeometry<TShape>(params AvaloniaProperty[])
Marks a property as affecting the shape's geometry.
protected static void AffectsGeometry<TShape>(params AvaloniaProperty[] properties) where TShape : Shape
Parameters
properties
AvaloniaProperty[]The properties.
Type Parameters
TShape
Remarks
After a call to this method in a control's static constructor, any change to the property will cause InvalidateGeometry() to be called on the element.
ArrangeOverride(Size)
Positions child elements as part of a layout pass.
protected override Size ArrangeOverride(Size finalSize)
Parameters
finalSize
SizeThe size available to the control.
Returns
- Size
The actual size used.
CreateDefiningGeometry()
Creates the shape's defining geometry.
protected abstract Geometry? CreateDefiningGeometry()
Returns
InvalidateGeometry()
Invalidates the geometry of this shape.
protected void InvalidateGeometry()
MeasureOverride(Size)
Measures the control and its child elements as part of a layout pass.
protected override Size MeasureOverride(Size availableSize)
Parameters
availableSize
SizeThe size available to the control.
Returns
- Size
The desired size for the control.
OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)
Called when the control is added to a rooted visual tree.
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
Parameters
e
VisualTreeAttachmentEventArgsThe event args.
OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
Called when the control is removed from a rooted visual tree.
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
Parameters
e
VisualTreeAttachmentEventArgsThe event args.
OnGeometryChanged(object?, EventArgs)
Called when the underlying Geometry changed
protected virtual void OnGeometryChanged(object? sender, EventArgs e)
Parameters
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe property change details.
Render(DrawingContext)
Renders the visual to a DrawingContext.
public override sealed void Render(DrawingContext context)
Parameters
context
DrawingContextThe drawing context.