Class Canvas
A panel that displays child controls at arbitrary locations.
public class Canvas : Panel, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, IChildIndexProvider, INavigableContainer
- Inheritance
-
Canvas
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Unlike other Panel implementations, the Canvas doesn't lay out its children in any particular layout. Instead, the positioning of each child control is defined by the
Canvas.Left
, Canvas.Top
, Canvas.Right
and Canvas.Bottom
attached properties.
Constructors
Canvas()
public Canvas()
Fields
BottomProperty
Defines the Bottom attached property.
public static readonly AttachedProperty<double> BottomProperty
Field Value
LeftProperty
Defines the Left attached property.
public static readonly AttachedProperty<double> LeftProperty
Field Value
RightProperty
Defines the Right attached property.
public static readonly AttachedProperty<double> RightProperty
Field Value
TopProperty
Defines the Top attached property.
public static readonly AttachedProperty<double> TopProperty
Field Value
Methods
ArrangeChild(Control, Size)
Arranges a single child.
protected virtual void ArrangeChild(Control child, Size finalSize)
Parameters
ArrangeOverride(Size)
Arranges the control's children.
protected override Size ArrangeOverride(Size finalSize)
Parameters
finalSize
SizeThe size allocated to the control.
Returns
- Size
The space taken.
GetBottom(AvaloniaObject)
Gets the value of the Bottom attached property for a control.
public static double GetBottom(AvaloniaObject element)
Parameters
element
AvaloniaObjectThe control.
Returns
- double
The control's bottom coordinate.
GetLeft(AvaloniaObject)
Gets the value of the Left attached property for a control.
public static double GetLeft(AvaloniaObject element)
Parameters
element
AvaloniaObjectThe control.
Returns
- double
The control's left coordinate.
GetRight(AvaloniaObject)
Gets the value of the Right attached property for a control.
public static double GetRight(AvaloniaObject element)
Parameters
element
AvaloniaObjectThe control.
Returns
- double
The control's right coordinate.
GetTop(AvaloniaObject)
Gets the value of the Top attached property for a control.
public static double GetTop(AvaloniaObject element)
Parameters
element
AvaloniaObjectThe control.
Returns
- double
The control's top coordinate.
MeasureOverride(Size)
Measures the control.
protected override Size MeasureOverride(Size availableSize)
Parameters
availableSize
SizeThe available size.
Returns
- Size
The desired size of the control.
SetBottom(AvaloniaObject, double)
Sets the value of the Bottom attached property for a control.
public static void SetBottom(AvaloniaObject element, double value)
Parameters
element
AvaloniaObjectThe control.
value
doubleThe bottom value.
SetLeft(AvaloniaObject, double)
Sets the value of the Left attached property for a control.
public static void SetLeft(AvaloniaObject element, double value)
Parameters
element
AvaloniaObjectThe control.
value
doubleThe left value.
SetRight(AvaloniaObject, double)
Sets the value of the Right attached property for a control.
public static void SetRight(AvaloniaObject element, double value)
Parameters
element
AvaloniaObjectThe control.
value
doubleThe right value.
SetTop(AvaloniaObject, double)
Sets the value of the Top attached property for a control.
public static void SetTop(AvaloniaObject element, double value)
Parameters
element
AvaloniaObjectThe control.
value
doubleThe top value.