Skip to content
This repository has been archived by the owner on Apr 10, 2020. It is now read-only.

Commit

Permalink
Fix issue where manipulations started from inside a ContextMenu would…
Browse files Browse the repository at this point in the history
… close it if IsZoomEnabled was false
  • Loading branch information
Kinnara committed Jan 22, 2014
1 parent 0a447d2 commit 6cc24cd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Microsoft.Phone.Controls.Toolkit/ContextMenu/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
Expand Down Expand Up @@ -843,7 +844,7 @@ private void InitializeRootVisual()
_rootVisual = Application.Current.RootVisual as
PhoneApplicationFrame;
if (null != _rootVisual)
{
{
_rootVisual.ManipulationCompleted -= OnRootVisualManipulationCompleted;
_rootVisual.ManipulationCompleted += OnRootVisualManipulationCompleted;

Expand Down Expand Up @@ -892,15 +893,14 @@ private void OnContextMenuOrRootVisualSizeChanged(object sender, SizeChangedEven
}

/// <summary>
/// Handles the MouseButtonUp events for the overlay.
/// Handles the ManipulationCompleted events for the overlay.
/// </summary>
/// <param name="sender">Source of the event.</param>
/// <param name="e">Event arguments.</param>
private void OnOverlayMouseButtonUp(object sender, MouseButtonEventArgs e)
private void OnOverlayManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
// If they clicked in the context menu, then don't close
List<UIElement> list = VisualTreeHelper.FindElementsInHostCoordinates(e.GetPosition(null), _rootVisual) as List<UIElement>;
if (!list.Contains(this))
FrameworkElement manipulationContainer = e.ManipulationContainer as FrameworkElement;
if (e.ManipulationContainer != null && !manipulationContainer.GetVisualAncestors().Contains(this))
{
ClosePopup();
}
Expand Down Expand Up @@ -1122,7 +1122,7 @@ private void OpenPopup(Point position)
}

_overlay = new Canvas { Background = new SolidColorBrush(Colors.Transparent) };
_overlay.MouseLeftButtonUp += OnOverlayMouseButtonUp;
_overlay.ManipulationCompleted += OnOverlayManipulationCompleted;

FrameworkElement ownerElement = _owner as FrameworkElement;
if (ReadLocalValue(FlowDirectionProperty) == DependencyProperty.UnsetValue)
Expand Down

0 comments on commit 6cc24cd

Please sign in to comment.