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

Move window when flyout is open #1821

Closed

Conversation

hercmaroudas
Copy link

When a flyout was open you weren't able to move the window where the flyout was over the title bar. This was particularly anoying if you wished to move the window while a flyout was opened as a modal flyout or covered the entire area of the window.

I've implemented a change that enables the window to be moved when a flyout is opened and the mouse cursor is within the windows title bar area.

If the default behaviour was intended by design perhaps this feature could be optional with a property.

I hope this is ok.

…yout theme and renaming event method names to more meaningful names in flyout control.
}
}

private void ClearParentWindowEvents(MetroWindow window)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be also called in FlyoutsControl to avoid memory leaks (cause it's possible to have dynamic flyouts)

        protected override void ClearContainerForItemOverride(DependencyObject element, object item)
        {
            var window = this.TryFindParent<MetroWindow>();
            if (window != null)
            {
                ((Flyout)element).ClearParentWindowEvents(window);
            }
            base.ClearContainerForItemOverride(element, item);
        }

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks Punker, added and sent the pull request.

…stion to avoid memory leaks when creating dynamic flyouts.
@punker76 punker76 added this to the 1.2.0 milestone Feb 27, 2015
@punker76
Copy link
Member

@hercmaroudas looks good, i'll be add this to 1.2.0

@hercmaroudas
Copy link
Author

Thanks @punker76 👍

@punker76 punker76 reopened this Feb 27, 2015
@thoemmi
Copy link
Collaborator

thoemmi commented Oct 23, 2015

Looks ok, though I don't like that Flyout accesses MetroWindow directly, but I have no better idea.

However, I would suggest some changes to your Flyout.xaml: In your PR you move the flyout's content down by the height of the titlebar. I'd prefer to keep the content where it is but overlay it with the PART_WindowTitle. So I'd remove the RowDefinitions again, add the Rectangle after the AdornerDecorator, and set its VerticalAlignment to Top:

    <AdornerDecorator>
        <!-- -->
    </AdornerDecorator>
    <Rectangle x:Name="PART_WindowTitle"
               Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Controls:MetroWindow}}}"
               HorizontalAlignment="Stretch" VerticalAlignment="Top"
               StrokeThickness="0"
               Fill="Transparent"/>

@punker76 punker76 mentioned this pull request Nov 23, 2015
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants