本文整理汇总了C#中Windows.UI.Xaml.Input.TappedRoutedEventArgs.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# TappedRoutedEventArgs.GetPosition方法的具体用法?C# TappedRoutedEventArgs.GetPosition怎么用?C# TappedRoutedEventArgs.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Input.TappedRoutedEventArgs
的用法示例。
在下文中一共展示了TappedRoutedEventArgs.GetPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawingField_Tapped
public void DrawingField_Tapped(object sender, TappedRoutedEventArgs e)
{
var drawingField = sender as Canvas;
if (drawingField != null)
{
double pointedX = e.GetPosition(this).X;
double pointedY = e.GetPosition(this).Y;
UIElement createElement = CreateSelectedElement();
Canvas.SetTop(createElement, pointedY - 100);
Canvas.SetLeft(createElement, pointedX - 100);
drawingField.Children.Add(createElement);
}
}
示例2: img_map_Tapped
private void img_map_Tapped(object sender, TappedRoutedEventArgs e)
{
Point tapped_point = e.GetPosition(img_map);
if (tapped_point.X > 190 && tapped_point.Y < 372)
{
Thickness margin = img_character.Margin;
margin.Left += 10;
img_character.Margin = margin;
}
if (tapped_point.X < 190 && tapped_point.Y < 372)
{
Thickness margin = img_character.Margin;
margin.Right += 10;
img_character.Margin = margin;
}
if (tapped_point.X > 190 && tapped_point.Y > 372)
{
Thickness margin = img_character.Margin;
margin.Bottom += 10;
img_character.Margin = margin;
}
if (tapped_point.X < 190 && tapped_point.Y > 372)
{
Thickness margin = img_character.Margin;
margin.Top += 10;
img_character.Margin = margin;
}
}
示例3: theCanvas_DoubleTapped
private void theCanvas_DoubleTapped(object sender, TappedRoutedEventArgs e)
{
e.Handled = true;
var position = e.GetPosition(this.theCanvas);
Canvas.SetTop(this.rect, position.Y);
Canvas.SetLeft(this.rect, position.X);
}
示例4: ImageTapped
private void ImageTapped(object sender, TappedRoutedEventArgs e)
{
var position = e.GetPosition((sender as FrameworkElement));
var closestMatch = ViewModel.Entries.Select(a => new
{
Entry = a,
Distance = Math.Sqrt(
Math.Pow(Math.Abs(position.X - a.X), 2) +
Math.Pow(Math.Abs(position.Y - a.Y), 2)
)
})
.OrderBy(a => a.Distance)
.FirstOrDefault();
if (closestMatch == null) return;
// More than 45% outside the radius isn't accurate enough.
if (closestMatch.Distance > closestMatch.Entry.Radius * 1.45) return;
switch (closestMatch.Entry.Entity.MarkerType)
{
case "Dealer":
var context = KernelResolver.Current.Get<IDealersViewModelContext>();
var dealer = context.Dealers.SingleOrDefault(a => a.Entity.Id == closestMatch.Entry.Entity.TargetId);
if (dealer == null) return;
ViewModelLocator.Current.NavigationViewModel.NavigateToDealerDetailPage.Execute(dealer);
break;
}
}
示例5: map_Tapped
private void map_Tapped(object sender, TappedRoutedEventArgs e)
{
var pos = e.GetPosition(SpeedTrapMap);
Location location;
//Take the tapped location and get a GPS coordinate pair from it using the Bing Maps API
SpeedTrapMap.TryPixelToLocation(pos, out location);
//Flyout control from Callisto. Very handy.
Flyout f = new Flyout();
// Flyout is a ContentControl so set your content within it.
f.Content = new NewSpeedTrap(location.Longitude, location.Latitude);
f.Placement = PlacementMode.Top;
f.PlacementTarget = layoutRoot; // this is an UI element (usually the sender)
layoutRoot.Children.Add(f.HostPopup);
f.Closed += (async (b, c) =>
{
layoutRoot.Children.Remove(f.HostPopup);
//Refresh the speed trap locations
await fetchSpeedTraps();
});
f.IsOpen = true;
}
示例6: butFav_Tapped
private void butFav_Tapped(object sender, TappedRoutedEventArgs e)
{
var p = e.GetPosition(null);
Bang(p);
if (ChangeViewState != null) ChangeViewState("AddFavourite", null);
}
示例7: _theCanvas_Tapped
private void _theCanvas_Tapped(object sender, TappedRoutedEventArgs e)
{
_pointerDeviceType.Text = e.PointerDeviceType.ToString();
var position = e.GetPosition(_root);
_x.Text = position.X.ToString();
_y.Text = position.Y.ToString();
}
开发者ID:MicrosoftDXGermany,项目名称:Windows-10-Feature-Demos,代码行数:7,代码来源:HowToGetCoordinatesOfTouchPoints.xaml.cs
示例8: OnTapped
protected override void OnTapped(TappedRoutedEventArgs e) {
Point pt = e.GetPosition(this);
// Create dot
Ellipse ellipse = new Ellipse {
Width = 3,
Height = 3,
Fill = this.Foreground
};
Canvas.SetLeft(ellipse, pt.X);
Canvas.SetTop(ellipse, pt.Y);
canvas.Children.Add(ellipse);
// Create text
TextBlock txtblk = new TextBlock {
Text = String.Format("{0}", pt),
FontSize = 24
};
Canvas.SetLeft(txtblk, pt.X);
Canvas.SetTop(txtblk, pt.Y);
canvas.Children.Add(txtblk);
e.Handled = true;
base.OnTapped(e);
}
示例9: ExecuteTappedCommand
private void ExecuteTappedCommand(TappedRoutedEventArgs args)
{
Canvas canvas = args.OriginalSource as Canvas;
if (canvas == null)
{
return;
}
int ellipsesCount = canvas.Children
.Where(c => c.GetType() == typeof(Ellipse))
.Count();
if (ellipsesCount >= MaxTaps)
{
return;
}
Ellipse circle = this.CreateEllipse(15, 15, DefaultEllipseColor);
Point position = args.GetPosition(canvas);
// Set the position of the new circles in the canvas.
Canvas.SetLeft(circle, position.X - circle.Width / 2);
Canvas.SetTop(circle, position.Y - circle.Height / 2);
canvas.Children.Add(circle);
}
示例10: gvMain_Tapped
private void gvMain_Tapped(object sender, TappedRoutedEventArgs e)
{
if (RenderingService.MagicRenderer != null && RenderingService.MagicRenderer is ISpriteRenderer)
{
var p = e.GetPosition(null);
((ISpriteRenderer)RenderingService.MagicRenderer).AddSprite(p.X, p.Y, 0, 0.3d);
}
}
示例11: OnTapped
// TODO: Use a combination of PointerPressed/PointerReleased instead of tap events
private async void OnTapped(object sender, TappedRoutedEventArgs e)
{
if (GameClient == null)
return;
var position = e.GetPosition(canvas);
await PerformBasicTouchNavigation(canvas, position.ToVector2());
}
示例12: MyMap_Tapped
void MyMap_Tapped(object sender, TappedRoutedEventArgs e)
{
var pos = e.GetPosition(MyMap);
Bing.Maps.Location location = new Bing.Maps.Location();
miniTockeShapeLayer = new MapShapeLayer();
MyMap.TryPixelToLocation(pos, out location);
GetAddressByLocation(location);
locationCollection.Add(location);
}
示例13: pageTapped_Tapped
public void pageTapped_Tapped(object sender, TappedRoutedEventArgs e)
{
Windows.Foundation.Point position = e.GetPosition(w.getSpaceship().image);
w.getSpaceship().velocity=new Vector((float)position.X, (float)position.Y);
timer.Tick += new EventHandler<object>(step);
timer.Interval = new TimeSpan(0, 0, 0, 0, 10);
timer.Start();
}
示例14: OnTap
private static void OnTap(object sender, TappedRoutedEventArgs e)
{
Grid c = sender as Grid;
ICommand cmd = c.GetValue(SelectionTappedCommandBehavior.CommandProperty) as ICommand;
object param = c.GetValue(SelectionTappedCommandBehavior.CommandParameterProperty) ?? e.GetPosition(c);
if (cmd != null && cmd.CanExecute(param))
{
cmd.Execute(param);
}
}
示例15: butClose_Tapped
private void butClose_Tapped(object sender, TappedRoutedEventArgs e)
{
if (RenderingService.MagicRenderer != null && RenderingService.MagicRenderer is ISpriteRenderer)
{
var p = e.GetPosition(null);
((ISpriteRenderer)RenderingService.MagicRenderer).AddSprite(p.X + 15, p.Y + 15, 0, 0.3d);
}
if (ChangeViewState != null) ChangeViewState("Minimized",null);
}