Class Viewbox
Viewbox is used to scale single child to fit in the available space.
public class Viewbox : Control, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
- Inheritance
-
Viewbox
- Implements
- Inherited Members
- Extension Methods
Constructors
Viewbox()
Initializes a new instance of the Viewbox class.
public Viewbox()
Fields
ChildProperty
Defines the Child property
public static readonly StyledProperty<Control?> ChildProperty
Field Value
StretchDirectionProperty
Defines the StretchDirection property.
public static readonly StyledProperty<StretchDirection> StretchDirectionProperty
Field Value
StretchProperty
Defines the Stretch property.
public static readonly StyledProperty<Stretch> StretchProperty
Field Value
Properties
Child
Gets or sets the child of the Viewbox
[Content]
public Control? Child { get; set; }
Property Value
Stretch
Gets or sets the stretch mode, which determines how child fits into the available space.
public Stretch Stretch { get; set; }
Property Value
StretchDirection
Gets or sets a value controlling in what direction contents will be stretched.
public StretchDirection StretchDirection { get; set; }
Property Value
Methods
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.
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.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe property change details.