diff --git a/src/Uno.Toolkit.UI/Controls/ZoomContentControl/BoundsVisibilityFlag.cs b/src/Uno.Toolkit.UI/Controls/ZoomContentControl/BoundsVisibilityFlag.cs
index 6e480c5a6..c5985e6de 100644
--- a/src/Uno.Toolkit.UI/Controls/ZoomContentControl/BoundsVisibilityFlag.cs
+++ b/src/Uno.Toolkit.UI/Controls/ZoomContentControl/BoundsVisibilityFlag.cs
@@ -1,15 +1,15 @@
-using System;
+//using System;
-namespace Uno.Toolkit.UI;
+//namespace Uno.Toolkit.UI;
-[Flags]
-public enum BoundsVisibilityFlag
-{
- Left = 1 << 0,
- Top = 1 << 1,
- Right = 1 << 2,
- Bottom = 1 << 3,
+//[Flags]
+//public enum BoundsVisibilityFlag
+//{
+// Left = 1 << 0,
+// Top = 1 << 1,
+// Right = 1 << 2,
+// Bottom = 1 << 3,
- None = 0,
- All = Left | Top | Right | Bottom,
-}
+// None = 0,
+// All = Left | Top | Right | Bottom,
+//}
diff --git a/src/Uno.Toolkit.UI/Controls/ZoomContentControl/ZoomContentControl.Properties.cs b/src/Uno.Toolkit.UI/Controls/ZoomContentControl/ZoomContentControl.Properties.cs
index d1139dc02..79746a6e2 100644
--- a/src/Uno.Toolkit.UI/Controls/ZoomContentControl/ZoomContentControl.Properties.cs
+++ b/src/Uno.Toolkit.UI/Controls/ZoomContentControl/ZoomContentControl.Properties.cs
@@ -400,7 +400,7 @@ public bool AutoZoomToCanvasOnSizeChanged
nameof(AdditionalMargin),
typeof(Thickness),
typeof(ZoomContentControl),
- new PropertyMetadata(Thickness.Empty, OnAdditionalMarginChanged));
+ new PropertyMetadata(new Thickness(0), OnAdditionalMarginChanged));
/// Gets or sets additional margins around the content.
public Thickness AdditionalMargin
@@ -410,23 +410,23 @@ public Thickness AdditionalMargin
}
#endregion
- #region DependencyProperty: ContentBoundsVisibility
-
- /// Identifies the ContentBoundsVisibility dependency property.
- public static DependencyProperty ContentBoundsVisibilityProperty { get; } = DependencyProperty.Register(
- nameof(ContentBoundsVisibility),
- typeof(BoundsVisibilityFlag),
- typeof(ZoomContentControl),
- new PropertyMetadata(BoundsVisibilityFlag.None));
-
- /// Gets or sets the visibility data for the content bounds.
- public BoundsVisibilityFlag ContentBoundsVisibility
- {
- get => (BoundsVisibilityFlag)GetValue(ContentBoundsVisibilityProperty);
- private set => SetValue(ContentBoundsVisibilityProperty, value);
- }
-
- #endregion
+ //#region DependencyProperty: ContentBoundsVisibility
+
+ ///// Identifies the ContentBoundsVisibility dependency property.
+ //public static DependencyProperty ContentBoundsVisibilityProperty { get; } = DependencyProperty.Register(
+ // nameof(ContentBoundsVisibility),
+ // typeof(BoundsVisibilityFlag),
+ // typeof(ZoomContentControl),
+ // new PropertyMetadata(BoundsVisibilityFlag.None));
+
+ ///// Gets or sets the visibility data for the content bounds.
+ //public BoundsVisibilityFlag ContentBoundsVisibility
+ //{
+ // get => (BoundsVisibilityFlag)GetValue(ContentBoundsVisibilityProperty);
+ // private set => SetValue(ContentBoundsVisibilityProperty, value);
+ //}
+
+ //#endregion
private static void OnHorizontalScrollValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) => ((ZoomContentControl)sender).OnHorizontalScrollValueChanged();
private static void OnVerticalScrollValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) => ((ZoomContentControl)sender).OnVerticalScrollValueChanged();
diff --git a/src/Uno.Toolkit.UI/Controls/ZoomContentControl/ZoomContentControl.cs b/src/Uno.Toolkit.UI/Controls/ZoomContentControl/ZoomContentControl.cs
index c11f759e8..f6b13f43e 100644
--- a/src/Uno.Toolkit.UI/Controls/ZoomContentControl/ZoomContentControl.cs
+++ b/src/Uno.Toolkit.UI/Controls/ZoomContentControl/ZoomContentControl.cs
@@ -31,11 +31,10 @@
using Windows.Devices.Input;
#endif
-using static Uno.Toolkit.UI.BoundsVisibilityFlag;
-
namespace Uno.Toolkit.UI;
[TemplatePart(Name = TemplateParts.RootGrid, Type = typeof(Grid))]
+[TemplatePart(Name = TemplateParts.Canvas, Type = typeof(Canvas))]
[TemplatePart(Name = TemplateParts.Presenter, Type = typeof(ContentPresenter))]
[TemplatePart(Name = TemplateParts.VerticalScrollBar, Type = typeof(ScrollBar))]
[TemplatePart(Name = TemplateParts.HorizontalScrollBar, Type = typeof(ScrollBar))]
@@ -45,6 +44,7 @@ public partial class ZoomContentControl : ContentControl
private static class TemplateParts
{
public const string RootGrid = "PART_RootGrid";
+ public const string Canvas = "PART_Canvas";
public const string Presenter = "PART_Presenter";
public const string HorizontalScrollBar = "PART_ScrollH";
public const string VerticalScrollBar = "PART_ScrollV";
@@ -52,7 +52,8 @@ private static class TemplateParts
}
public event EventHandler? RenderedContentUpdated;
-
+
+ private Canvas? _canvas;
private ContentPresenter? _presenter;
private ScrollBar? _scrollV;
private ScrollBar? _scrollH;
@@ -60,20 +61,10 @@ private static class TemplateParts
private Point _lastPosition = new Point(0, 0);
private (bool Horizontal, bool Vertical) _movementDirection = (false, false);
- private bool IsAllowedToWork => (IsEnabled && IsActive && _presenter is not null);
+ private bool IsAllowedToWork => (IsLoaded && IsActive && _presenter is not null);
private uint _capturedPointerId;
private Point _referencePosition;
- public Size AvailableSize
- {
- get
- {
- var vOffset = (AdditionalMargin.Top + AdditionalMargin.Bottom);
- var hOffset = (AdditionalMargin.Left + AdditionalMargin.Right);
- return new Size(ActualWidth - hOffset, ActualHeight - vOffset);
- }
- }
-
public ZoomContentControl()
{
DefaultStyleKey = typeof(ZoomContentControl);
@@ -98,13 +89,14 @@ T FindTemplatePart(string name) where T : class =>
_scrollV = FindTemplatePart(TemplateParts.VerticalScrollBar);
_scrollH = FindTemplatePart(TemplateParts.HorizontalScrollBar);
_translation = FindTemplatePart(TemplateParts.TranslateTransform);
+ _canvas = FindTemplatePart