diff --git a/doc/controls/ZoomContentControl.md b/doc/controls/ZoomContentControl.md new file mode 100644 index 000000000..b8c95813e --- /dev/null +++ b/doc/controls/ZoomContentControl.md @@ -0,0 +1,68 @@ +--- +uid: Toolkit.Controls.ZoomContentControl +--- + +# 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](../getting-started.md) 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\# + +```csharp +public partial class ZoomContentControl : Control +``` + +### XAML + +```xml +xmlns:utu="using:Uno.Toolkit.UI" +... + + + + + + +``` + +### 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. | diff --git a/doc/toc.yml b/doc/toc.yml index 063595b2c..7954e347d 100644 --- a/doc/toc.yml +++ b/doc/toc.yml @@ -51,6 +51,8 @@ href: controls/ShadowContainer.md - name: TabBar and TabBarItem href: controls/TabBarAndTabBarItem.md + - name: ZoomContentControl + href: controls/ZoomContentControl.md # ***************** Reference\Helpers ******************* - name: Helpers items: diff --git a/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Controls/ZoomContentControlSamplePage.xaml b/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Controls/ZoomContentControlSamplePage.xaml new file mode 100644 index 000000000..b0bdca11c --- /dev/null +++ b/samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Controls/ZoomContentControlSamplePage.xaml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + +