Class Viewbox
Defines a content decorator that can stretch and scale a single child to fill the available space.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
public class Viewbox : ContentControl
Constructors
| Improve this Doc View SourceViewbox()
Initializes a new instance of the Viewbox class.
Declaration
public Viewbox()
Fields
| Improve this Doc View SourceStretchDirectionProperty
Identifies the Viewbox.StretchDirection dependency property.
Declaration
public static readonly DependencyProperty StretchDirectionProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the Viewbox.StretchDirection dependency property. |
StretchProperty
Identifies the Viewbox.Stretch dependency property.
Declaration
public static readonly DependencyProperty StretchProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the Viewbox.Stretch dependency property. |
Properties
| Improve this Doc View SourceChild
Gets or sets the single child element of a Viewbox element.
Declaration
public UIElement Child { get; set; }
Property Value
Type | Description |
---|---|
UIElement | The single child element of a Viewbox element. |
Remarks
Child must be an alias of ContentControl.Content property to ensure continuous namescope, ie, named element within Viewbox can be found.
Stretch
Gets or sets the Stretch mode, which determines how content fits into the available space. The default is Stretch.Uniform.
Declaration
public Stretch Stretch { get; set; }
Property Value
Type | Description |
---|---|
Stretch | A Stretch mode, which determines how content fits in the available space. The default is Stretch.Uniform. |
StretchDirection
Gets or sets the StretchDirection, which determines how scaling is applied to the contents of a Viewbox. The default is StretchDirection.Both.
Declaration
public StretchDirection StretchDirection { get; set; }
Property Value
Type | Description |
---|---|
StretchDirection | A StretchDirection, which determines how scaling is applied to the contents of a Viewbox. The default is StretchDirection.Both. |
Methods
| Improve this Doc View SourceInvalidateMeasure()
Declaration
public void InvalidateMeasure()
OnApplyTemplate()
Builds the visual tree for the Viewbox control when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnContentChanged(Object, Object)
Declaration
protected override void OnContentChanged(object oldContent, object newContent)
Parameters
Type | Name | Description |
---|---|---|
System.Object | oldContent | |
System.Object | newContent |
Overrides
| Improve this Doc View SourceOnSizeChanged(Object, SizeChangedEventArgs)
Declaration
protected virtual void OnSizeChanged(object sender, SizeChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
SizeChangedEventArgs | e |