当前位置: 首页>>代码示例>>C#>>正文


C# TappedRoutedEventArgs.GetPosition方法代码示例

本文整理汇总了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);
			}
		}
开发者ID:krstan4o,项目名称:TelerikAcademy,代码行数:13,代码来源:MainPage.cs

示例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;
            }
        }
开发者ID:Ruude,项目名称:TP-IHM,代码行数:32,代码来源:map.xaml.cs

示例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);
 }
开发者ID:TelerikAcademy,项目名称:Windows-Applications,代码行数:7,代码来源:MainPage.xaml.cs

示例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;
            }
        }
开发者ID:eurofurence,项目名称:ef-app_wp,代码行数:33,代码来源:MapViewerControl.xaml.cs

示例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;
        }
开发者ID:pbgodwin,项目名称:Speed-Trap-Demo-App,代码行数:27,代码来源:MainPage.xaml.cs

示例6: butFav_Tapped

 private void butFav_Tapped(object sender, TappedRoutedEventArgs e)
 {
     var p = e.GetPosition(null);
     Bang(p);
     
     if (ChangeViewState != null) ChangeViewState("AddFavourite", null);
 }
开发者ID:rolandsmeenk,项目名称:ModernApps,代码行数:7,代码来源:PictureToolbar.xaml.cs

示例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);
        }
开发者ID:ronlemire2,项目名称:UWP-Testers,代码行数:28,代码来源:TapAndShowPointPage.xaml.cs

示例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);
        }
开发者ID:TsvetanMilanov,项目名称:RoomMeasurer,代码行数:28,代码来源:CanvasWithSelectableBackgroundViewModel.cs

示例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);
     }
 }
开发者ID:rolandsmeenk,项目名称:ModernApps,代码行数:8,代码来源:ListOfFavouritePics.xaml.cs

示例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());
        }
开发者ID:SvenEV,项目名称:OrangeBugReloaded,代码行数:9,代码来源:OrangeBugPresenter.xaml.cs

示例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);
 }
开发者ID:rvajs,项目名称:MetroDiplomaDrugiDel,代码行数:9,代码来源:IzbiraTockPage.xaml.cs

示例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();
        }
开发者ID:eaortiz,项目名称:Planets,代码行数:9,代码来源:Game.cs

示例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);
            }
        }
开发者ID:nedevny,项目名称:tic-tac-toe-ultimate,代码行数:11,代码来源:SelectionTappedCommandBehavior.cs

示例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);

        }
开发者ID:rolandsmeenk,项目名称:ModernApps,代码行数:11,代码来源:PictureExif.xaml.cs


注:本文中的Windows.UI.Xaml.Input.TappedRoutedEventArgs.GetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。