本文整理汇总了C#中Windows.UI.Xaml.UIElement.ReleasePointerCapture方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.ReleasePointerCapture方法的具体用法?C# UIElement.ReleasePointerCapture怎么用?C# UIElement.ReleasePointerCapture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.UIElement
的用法示例。
在下文中一共展示了UIElement.ReleasePointerCapture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPointerReleased
public static void OnPointerReleased(UIElement sender, TouchSliderC slider, PointerRoutedEventArgs e)
{
sender.ReleasePointerCapture(e.Pointer);
_isDragActive = false;
if (_lastPoint != null &&
(_lastPoint.Position.X < 0 || _lastPoint.Position.Y < 0 || _lastPoint.Position.X > slider._trackBackground.ActualWidth || _lastPoint.Position.Y > slider._trackBackground.ActualHeight))
slider.RaiseOnPointerExited(e);
e.Handled = true;
}
示例2: PointerReleased
private void PointerReleased(PointerPoint pointerPoint, UIElement target, Pointer pointer)
{
// To convert from DIPs (device independent pixels) to screen resolution pixels.
var dipFactor = DisplayProperties.LogicalDpi / 96.0f;
var pos = new Vector2((float)pointerPoint.Position.X, (float)pointerPoint.Position.Y) * dipFactor;
var isTouch = pointerPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Touch;
_touchQueue.Enqueue((int)pointerPoint.PointerId, TouchLocationState.Released, pos, !isTouch);
if (!isTouch)
{
// Mouse or stylus event.
UpdateMouse(pointerPoint);
// Release the captured pointer.
if (target != null)
target.ReleasePointerCapture(pointer);
}
}
示例3: EndFluidDragAsync
/// <summary>
/// Handler for the event when the user stops dragging the dragElement and releases it.
/// </summary>
/// <param name="child">UIElement being dragged</param>
/// <param name="position">Position where the user clicked w.r.t. the UIElement being dragged</param>
/// <param name="positionInParent">Position where the user clicked w.r.t. the FluidWrapPanel (the parentFWPanel of the UIElement being dragged</param>
internal async Task EndFluidDragAsync(UIElement child, Point position, Point positionInParent, Pointer pointer)
{
if ((child == null) || (!IsComposing) || (_dragElement == null))
return;
// Call the event handler core on the Dispatcher. (Improves efficiency!)
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
_dragElement.RenderTransform = CreateTransform(positionInParent.X - _dragStartPoint.X,
positionInParent.Y - _dragStartPoint.Y,
DragScale,
DragScale);
child.Opacity = NORMAL_OPACITY;
// Z-Index is set to 1 so that during the animation it does not go below other elements.
child.SetValue(Canvas.ZIndexProperty, Z_INDEX_INTERMEDIATE);
// Release the mouse capture
child.ReleasePointerCapture(pointer);
// Reference used to set the Z-Index to 0 during the UpdateFluidLayout
_lastDragElement = _dragElement;
_dragElement = null;
_lastExchangeElement = null;
InvalidateMeasure();
});
}
示例4: EndFluidDrag
/// <summary>
/// Handler for the event when the user stops dragging the dragElement and releases it.
/// </summary>
/// <param name="child">UIElement being dragged</param>
/// <param name="position">Position where the user clicked w.r.t. the UIElement being dragged</param>
/// <param name="positionInParent">Position where the user clicked w.r.t. the FluidWrapPanel</param>
/// <param name="pointer">Pointer</param>
internal void EndFluidDrag(UIElement child, Point position, Point positionInParent, Pointer pointer)
{
if ((child == null) || (!IsComposing) || (_dragElement == null))
return;
// Set the offset of the _dragElement's visual
var visual = _fluidVisuals[_dragElement];
visual.ImplicitAnimations = _implicitAnimationCollection;
visual.Opacity = 1f;
visual.Scale = Vector3.One;
visual.Offset = new Vector3((float)(positionInParent.X - _dragStartPoint.X),
(float)(positionInParent.Y - _dragStartPoint.Y),
0);
//visual.CenterPoint = new Vector3((float)(ItemWidth / 2), (float)(ItemHeight / 2), 0);
// Z-Index is set to 1 so that during the animation it does not go below other elements.
child.SetValue(Canvas.ZIndexProperty, ZIndexIntermediate);
// Release the pointer capture
child.ReleasePointerCapture(pointer);
_dragElement = null;
_lastExchangedElement = null;
InvalidateArrange();
}