ZoomContentControl
Tip
This guide covers details for the ZoomContentControl
. If you are just getting started with the Uno Toolkit UI Library, please see our general getting started page to make sure you have the correct setup in place.
Summary
ZoomContentControl
allows you to display content that can be zoomed in and out, as well as panned. It is especially useful for scenarios such as viewing large images, maps, or documents where users need control over zoom levels and panning.
C#
public partial class ZoomContentControl : Control
XAML
xmlns:utu="using:Uno.Toolkit.UI"
...
<utu:ZoomContentControl ZoomLevel="1.5"
MinZoomLevel="0.5"
MaxZoomLevel="3.0"
IsZoomAllowed="True"
IsPanAllowed="True">
<utu:ZoomContentControl.Content>
<Image Source="ms-appx:///Assets/Media/LargeMedia.svg"
Stretch="Uniform" />
</utu:ZoomContentControl.Content>
</utu:ZoomContentControl>
Inheritance
Object
→ DependencyObject
→ UIElement
→ FrameworkElement
→ Control
→ ContentControl
→ ZoomContentControl
Constructors
Constructor | Description |
---|---|
ZoomContentControl() |
Initializes a new instance of the ZoomContentControl class. |
Properties
Property | Type | Description |
---|---|---|
ZoomLevel |
double |
Gets or sets the current zoom level for the content. |
MinZoomLevel |
double |
Gets or sets the minimum zoom level allowed for the content. |
MaxZoomLevel |
double |
Gets or sets the maximum zoom level allowed for the content. |
IsZoomAllowed |
bool |
Gets or sets a value indicating whether zooming is allowed. |
ScaleWheelRatio |
double |
Gets or sets the ratio for scaling zoom level when using a mouse wheel. |
PanWheelRatio |
double |
Gets or sets the ratio for panning when using a mouse wheel. |
IsPanAllowed |
bool |
Gets or sets a value indicating whether panning is allowed. |
IsActive |
bool |
Gets or sets a value indicating whether the control is active. |
AutoFitToCanvas |
bool |
Determines if the content should automatically fit into the available canvas when the control resizes. |
AdditionalMargin |
Thickness |
Gets or sets additional margins around the content. |
Methods
Method | Return Type | Description |
---|---|---|
FitToCanvas() |
void |
Adjust the zoom level so that the content fits within the available space. |
ResetViewport() |
void |
Resets the zoom level and panning offset to their default values and centers the content. |