Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when using Overlay inside a Zoombox #76

Open
sa-he opened this issue Oct 19, 2021 · 2 comments
Open

Issue when using Overlay inside a Zoombox #76

sa-he opened this issue Oct 19, 2021 · 2 comments

Comments

@sa-he
Copy link

sa-he commented Oct 19, 2021

Having the following minimal code sample in a plain WPF window.

    xmlns:adorn="http://gu.se/Adorners"
    xmlns:geo="http://gu.se/Geometry"
   ...
   <geo:Zoombox>
        <Rectangle
            Width="50"
            Height="50"
            Fill="Red">
            <adorn:Overlay.Content>
                <Border BorderBrush="Green" BorderThickness="10" />
            </adorn:Overlay.Content>
        </Rectangle>
    </geo:Zoombox>
  1. When zooming (mouse wheel) or dragging, the size and position of the Overlay (green border) stays the same. It refreshes e.g. when changing the position of the whole window. How can I force the Overlay to refresh as soon as the Zoombox has changed it's zoom or position?
  2. The Zoombox's features do not work if the mouse is above the Overlay (green border). Setting the border IsHitTestVisible="False" solves that problem, but in some scenarios I cannot do that (for I need to handle some mouse events). Is there a way to have IsHitTestVisible="True" and still forward the UI-events to the Zoombox so that I can do it's job?
@sa-he
Copy link
Author

sa-he commented Nov 15, 2021

  1. seems to have it's source in the Zoobmox rather than Overlay. Calling InvalidateVisual seems to fix the problem.
        public static readonly DependencyProperty ContentMatrixProperty = DependencyProperty.Register(
            nameof(ContentMatrix),
            typeof(Matrix),
            typeof(Zoombox),
            new PropertyMetadata(
                default(Matrix),
                (d, e) =>
                {
                    var zb = (Zoombox)d;
                    ((MatrixTransform)zb.InternalVisual.Transform).SetCurrentValue(MatrixTransform.MatrixProperty, (Matrix)e.NewValue);
                    zb.InvalidateVisual();
                }));

@JohanLarsson
Copy link
Member

Tricky case, thanks for reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants