本文整理汇总了C#中Windows.UI.Xaml.Input.HoldingRoutedEventArgs.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# HoldingRoutedEventArgs.GetPosition方法的具体用法?C# HoldingRoutedEventArgs.GetPosition怎么用?C# HoldingRoutedEventArgs.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Input.HoldingRoutedEventArgs
的用法示例。
在下文中一共展示了HoldingRoutedEventArgs.GetPosition方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImageToAdd_Holding
private void ImageToAdd_Holding(object sender, HoldingRoutedEventArgs e)
{
if (sender.GetType() == typeof(Image))
ImageToAdd_CreateDropDownMenu(sender as Image, e.GetPosition(sender as Image));
else
throw new Exception("Error: Expected sender to be Image but was: " + sender.GetType().ToString());
}
示例2: LayoutRoot_Holding
private void LayoutRoot_Holding(object sender, HoldingRoutedEventArgs e)
{
if (e.HoldingState != Windows.UI.Input.HoldingState.Started)
return;
IsHolding = true;
var targetElement = sender as FrameworkElement;
MenuFlyout flyout = (MenuFlyout)FlyoutBase.GetAttachedFlyout(targetElement);
flyout.ShowAt(targetElement, e.GetPosition(targetElement));
}
示例3: UiElementOnHolding
private void UiElementOnHolding(object sender, HoldingRoutedEventArgs e)
{
if (e.HoldingState == HoldingState.Completed && uiElement != null)
{
var position = e.GetPosition(uiElement);
ShowMenu(position);
e.Handled = true;
isPointerPressed = false;
uiElement.CancelDirectManipulations();
}
}
示例4: OnHolding
public override void OnHolding(HoldingRoutedEventArgs e)
{
base.OnHolding(e);
if (e.HoldingState == HoldingState.Started)
{
Point2D point = Map.ScreenToMap(e.GetPosition(Map));
if (_points == null || _points.Count < 1)
{
//当点的个数小余一个时,不能结束。
return;
}
else
{
DrawPoint(point, false);
Complete();
}
}
}
示例5: ContentRoot_Holding
/// <summary>
/// Fired when the image is press and held
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ContentRoot_Holding(object sender, HoldingRoutedEventArgs e)
{
FrameworkElement element = sender as FrameworkElement;
if (element != null)
{
Point p = e.GetPosition(element);
flyoutMenu.ShowAt(element, p);
}
}
示例6: OnHolding
protected override void OnHolding(HoldingRoutedEventArgs e)
{
// Responding to HoldingState.Started will show a context menu while your finger is still down, while
// HoldingState.Completed will wait until the user has removed their finger.
if (e.HoldingState == Windows.UI.Input.HoldingState.Completed)
{
var PointerPosition = e.GetPosition(null);
var MyObject = (e.OriginalSource as FrameworkElement).DataContext as SampleDataModel;
ShowContextMenu(MyObject, null, PointerPosition);
e.Handled = true;
// This, combined with a check in OnRightTapped prevents the firing of RightTapped from
// launching another context menu
_IsPointerPressed = false;
// This prevents any scrollviewers from continuing to pan once the context menu is displayed.
// Ideally, you should find the ListViewItem itself and only CancelDirectMinpulations on that item.
var ItemsToCancel = VisualTreeHelper.FindElementsInHostCoordinates(PointerPosition, ItemListView);
foreach (var Item in ItemsToCancel)
{
var Result = Item.CancelDirectManipulations();
}
}
base.OnHolding(e);
}
示例7: OnHolding
/// <summary>
/// ${ui_action_DrawLine_event_OnHolding_D}
/// </summary>
public override void OnHolding(HoldingRoutedEventArgs e)
{
base.OnHolding(e);
if (e.HoldingState == HoldingState.Started)
{
Point2D item = Map.ScreenToMap(e.GetPosition(Map));
if (_points == null || _points.Count < 1)
return;
else
{
while (_points.Count > _pointsCount)
{
_points.RemoveAt(_points.Count - 1);
}
_points.Add(item);
_pointsCount++;
}
endDraw(false);
}
}
示例8: DataGrid_Holding
private void DataGrid_Holding(object sender, HoldingRoutedEventArgs e)
{
if (e.PointerDeviceType != PointerDeviceType.Mouse)
{
if (e.HoldingState == HoldingState.Started)
{
var pt = e.GetPosition(_cellPanel);
int row = GetRowFromPoint(pt);
_cellPanel.HandlePointerPressed(row);
}
//Completed when pointer release
//Canceled when pointer move
else
{
_cellPanel.ClearPointerPressedAnimation();
}
}
}
示例9: TouchPanel_Holding
void TouchPanel_Holding(object sender, HoldingRoutedEventArgs e)
{
// prevent twice holding
if (e.HoldingState == Windows.UI.Input.HoldingState.Completed)
return;
Geopoint point;
MapCtrl.GetLocationFromOffset(e.GetPosition(MapCtrl), out point);
LastSearchGeopoint = new Geopoint(new BasicGeoposition() { Latitude = point.Position.Latitude, Longitude = point.Position.Longitude });
ShowSearchLocationPoint(LastSearchGeopoint, string.Empty);
//MapCtrl.TrySetViewAsync(LastSearchGeopoint,null,null,null,MapAnimationKind.None);
//ReverseGeocode(true);
}
示例10: TranslationItemHolding
private void TranslationItemHolding(object sender, HoldingRoutedEventArgs e)
{
if (!_isShowingContextMenu)
{
_isShowingContextMenu = true;
TranslationItemHoldingOrRightTapped(sender, e.GetPosition(null), e.OriginalSource);
}
}
示例11: ImageHolding
private async void ImageHolding(object sender, HoldingRoutedEventArgs e)
{
if (!_isShowingContextMenu)
{
_isShowingContextMenu = true;
await ImageHoldingOrRightTapped(sender, (ui) => { return e.GetPosition(ui); });
}
}
示例12: Canvas_Holding_1
private void Canvas_Holding_1(object sender, HoldingRoutedEventArgs e)
{
//Allow drawing
var thisCanvas = sender as Canvas;
thisCanvas.CancelDirectManipulations();
Point ptPos = e.GetPosition(thisCanvas);
ptPos.Y -= 40;
ptPos.X += 40;
flashText.SetValue(Canvas.LeftProperty, ptPos.X);
flashText.SetValue(Canvas.TopProperty, ptPos.Y);
flashText.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
示例13: OnHolding
/// <summary>
/// ${ui_action_DrawPolygon_event_OnHolding_D}
/// </summary>
public override void OnHolding(HoldingRoutedEventArgs e)
{
base.OnHolding(e);
if (e.HoldingState == HoldingState.Started)
{
//如果只画了小于或等于两个点的话,就不执行完成事件。
if (_points == null || _points.Count < 2)
return;
while (_points.Count > _pointsCount)
{
_points.RemoveAt(_points.Count - 2);
}
Point2D item = Map.ScreenToMap(e.GetPosition(Map));
_points.Insert(_points.Count - 1, item);
_pointsCount++;
endDraw(false);
}
}
示例14: MyMap_Holding
void MyMap_Holding(object sender, HoldingRoutedEventArgs e)
{
if (!AddPointPopup.IsOpen && !drawingPointerIsOn) { AddPointPopup.IsOpen = true;
pressedLocation = myMap.ViewportPointToLocation(e.GetPosition(myMap));
}
else
{
MapGrid.CancelDirectManipulations();
}
}