Flyout closing on formatting element
I have a Flyout, with the IsPinned property set to false, so it will close when a mousedown occurs outside the Flyout. In the Flyout, there is a TextBlock with some formatting elements inside (eg. Run, Hyperlink, etc.). When I click the Hyperlink, or any other formatting element, the Flyout closes.
I found out that this piece of code causes the Flyout close (starting at line 736 in MetroWindow.cs):
private void FlyoutsPreviewMouseDown(object sender, MouseButtonEventArgs e)
{
FrameworkElement element = (e.OriginalSource as FrameworkElement);
if (element != null && element.TryFindParent<Flyout>() != null)
These formatting elements do not inherit FrameworkElement, so the code after these lines closes all open Flyouts with IsPinned set to false. This problem can be solved by changing FrameworkElement to DependencyObject.
Does this modification have any consequenses (except for not closing the Flyout)?
Want to submit a PR for this?
OK, but my fork is a bit messy since I was working on the Flyout animation and then found out that I was working on the master branch, so I reverted those commits and did them on the appropriate branch.