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


C# RightTappedRoutedEventArgs.GetPosition方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Input.RightTappedRoutedEventArgs.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# RightTappedRoutedEventArgs.GetPosition方法的具体用法?C# RightTappedRoutedEventArgs.GetPosition怎么用?C# RightTappedRoutedEventArgs.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Input.RightTappedRoutedEventArgs的用法示例。


在下文中一共展示了RightTappedRoutedEventArgs.GetPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ImageToAdd_RightTapped

 private void ImageToAdd_RightTapped(object sender, RightTappedRoutedEventArgs 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());
 }
开发者ID:tomazio21,项目名称:DocFingerPrinterBeta,代码行数:7,代码来源:FilesPage.xaml.cs

示例2: OnRightTapped

 protected override void OnRightTapped(RightTappedRoutedEventArgs e) {
     if (_IsPointerPressed) {
         ShowContextMenu(null, e.GetPosition(null));
         e.Handled = true;
     }
     base.OnRightTapped(e);
 }
开发者ID:ronlemire2,项目名称:UWP-Testers,代码行数:7,代码来源:rjlSimpleMenuFlyoutPage.xaml.cs

示例3: AccountList_RightTapped

        private void AccountList_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            var senderElement = sender as FrameworkElement;
            var flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement) as MenuFlyout;

            flyoutBase?.ShowAt(senderElement, e.GetPosition(senderElement));
        }
开发者ID:NPadrutt,项目名称:MoneyFox.Windows,代码行数:7,代码来源:AccountListView.xaml.cs

示例4: LayoutRoot_RightTapped

 private void LayoutRoot_RightTapped(object sender, RightTappedRoutedEventArgs e)
 {
     if (IsHolding)
         return;
     var targetElement = sender as FrameworkElement;
     MenuFlyout flyout = (MenuFlyout)FlyoutBase.GetAttachedFlyout(targetElement);
     flyout.ShowAt(targetElement, e.GetPosition(targetElement));
 }
开发者ID:akshay2000,项目名称:MonocleGiraffe,代码行数:8,代码来源:ImageUserControl.xaml.cs

示例5: UiElementOnRightTapped

 private void UiElementOnRightTapped(object sender, RightTappedRoutedEventArgs e)
 {
     if (isPointerPressed)
     {
         ShowMenu(e.GetPosition(uiElement));
         e.Handled = true;
     }
 }
开发者ID:Opiumtm,项目名称:DvachBrowser3,代码行数:8,代码来源:PopupLogicHelper.cs

示例6: OcrListItem_RightTapped

 private void OcrListItem_RightTapped(object sender, RightTappedRoutedEventArgs e)
 {
     FrameworkElement element = sender as FrameworkElement;
     if (element == null)
     {
         return;
     }
     var flyout = FlyoutBase.GetAttachedFlyout(element) as MenuFlyout;
     flyout?.ShowAt(this, e.GetPosition(null));
 }
开发者ID:pingzing,项目名称:SimpleOcr10,代码行数:10,代码来源:MainPage.xaml.cs

示例7: OnTextBlockRightTapped

        async void OnTextBlockRightTapped(object sender, RightTappedRoutedEventArgs e) {
            PopupMenu popupMenu = new PopupMenu();
            popupMenu.Commands.Add(new UICommand("Larger Font", OnFontSizeChanged, 1.2));
            popupMenu.Commands.Add(new UICommand("Smaller Font", OnFontSizeChanged, 1 / 1.2));
            popupMenu.Commands.Add(new UICommandSeparator());
            popupMenu.Commands.Add(new UICommand("Red", OnColorChanged, Colors.Red));
            popupMenu.Commands.Add(new UICommand("Green", OnColorChanged, Colors.Green));
            popupMenu.Commands.Add(new UICommand("Blue", OnColorChanged, Colors.Blue));

            await popupMenu.ShowAsync(e.GetPosition(this));
        }
开发者ID:ronlemire2,项目名称:UWP-Testers,代码行数:11,代码来源:SimpleContextMenuPage.xaml.cs

示例8: drawingCanvas_RightTapped

        private void drawingCanvas_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            Point mouseLocation = e.GetPosition(this.drawingCanvas);
            Circle myCircle = new Circle(100);

            if (myCircle is IDraw)
            {
                IDraw drawCircle = myCircle;
                drawCircle.SetLocation((int)mouseLocation.X, (int)mouseLocation.Y);
                drawCircle.Draw(drawingCanvas);
            }
            if (myCircle is IColor)
            {
                IColor colorCircle = myCircle;
                colorCircle.SetColor(Colors.HotPink);
            }
        }
开发者ID:theWindSweptDev,项目名称:adamant-guacamole,代码行数:17,代码来源:DrawingPad.xaml.cs

示例9: Border_RightTapped

 object selected_item;  //选中项的数据源
 /// <summary>
 /// 右键收藏,弹出菜单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Border_RightTapped(object sender, RightTappedRoutedEventArgs e)
 {
     UIElement uie = e.OriginalSource as UIElement;
     selected_item = (e.OriginalSource as FrameworkElement).DataContext;
     (this.Resources["contextMenu"] as MenuFlyout).ShowAt(uie, e.GetPosition(uie));           
 }
开发者ID:tianzhaodong,项目名称:ZhiHuDaily.UWP,代码行数:12,代码来源:CollectionPage.xaml.cs

示例10: ItemView_ItemRightTapped

        private async void ItemView_ItemRightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            var pos = e.GetPosition(this);

            var elements = VisualTreeHelper.FindElementsInHostCoordinates(pos, ((UIElement)sender));

            FrameworkElement selectedElement = null;
            Station selectedStation = null;

            //I could refactor this
            if (sender is GridView)
            {
                selectedElement = (FrameworkElement)elements.FirstOrDefault(x => x.GetType() == typeof(GridViewItem));
            }
            else if (sender is ListView)
            {
                selectedElement = (FrameworkElement)elements.FirstOrDefault(x => x.GetType() == typeof(ListViewItem));
            }

            if (selectedElement != null)
            {
                e.Handled = true;

                selectedStation = (Station)selectedElement.DataContext;

                PopupMenu menu = new PopupMenu();
                menu.Commands.Add(new UICommand(LocalizationManager.GetLocalizedValue("GotoHomepageMenu"), (command) =>
                {
                    Windows.System.Launcher.LaunchUriAsync(selectedStation.HomepageUrl);
                }));

                this.BottomAppBar.IsSticky = true;
                this.TopAppBar.IsSticky = true;

                var chosenCommand = await menu.ShowForSelectionAsync(new Rect(pos, selectedElement.RenderSize));

                this.BottomAppBar.IsSticky = false;
                this.TopAppBar.IsSticky = false;

            }
        }
开发者ID:Amrykid,项目名称:Hanasu,代码行数:41,代码来源:MainPage.xaml.cs

示例11: OnRightTapped

        protected override void OnRightTapped(RightTappedRoutedEventArgs e)
        {
            if (_IsPointerPressed)
            {
                var MyObject = (e.OriginalSource as FrameworkElement).DataContext as SampleDataModel;

                ShowContextMenu(MyObject, null, e.GetPosition(null));
                e.Handled = true;
            }

            base.OnRightTapped(e);
        }
开发者ID:hirokuma3,项目名称:Windows-universal-samples,代码行数:12,代码来源:Scenario1.xaml.cs

示例12: ContentRoot_RightTapped

 /// <summary>
 /// Fired when the image is right clicked
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ContentRoot_RightTapped(object sender, RightTappedRoutedEventArgs e)
 {
     FrameworkElement element = sender as FrameworkElement;
     if (element != null)
     {
         Point p = e.GetPosition(element);
         flyoutMenu.ShowAt(element, p);
     }
 }
开发者ID:eugeniopacceli,项目名称:Baconit,代码行数:14,代码来源:BasicImageContentPanel.xaml.cs

示例13: Files_Right_Click

        private void Files_Right_Click(object sender, RightTappedRoutedEventArgs e)
        {
            //var s = (FrameworkElement)sender;
            var d = ((FrameworkElement)e.OriginalSource).DataContext;
            System.Diagnostics.Debug.WriteLine("Selected Type :" + d.GetType());

            Models.Node node = (Models.Node)d;

            Files.SelectedItem = node;
            System.Diagnostics.Debug.WriteLine("Selected item :" + ((Models.Node)Files.SelectedItem).Label);

            ShowContextMenu(null, e.GetPosition(null));
        }
开发者ID:lamarios,项目名称:Pydio-UWP,代码行数:13,代码来源:Browser.xaml.cs

示例14: OnTextBlockRightTapped

        private void OnTextBlockRightTapped(object sender, RightTappedRoutedEventArgs e) {
            StackPanel stackPanel = new StackPanel();

            // Create two Button controls and add to StackPanel
            Button btn1 = new Button {
                Content = "Larger font",
                Tag = 1.2,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = new Thickness(12)
            };
            btn1.Click += OnButtonClick;
            stackPanel.Children.Add(btn1);

            Button btn2 = new Button {
                Content = "Smaller font",
                Tag = 1 / 1.2,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = new Thickness(12)
            };
            btn2.Click += OnButtonClick;
            stackPanel.Children.Add(btn2);

            // Create three RadioButton controls and add to StackPanel
            string[] names = { "Red", "Green", "Blue" };
            Color[] colors = { Colors.Red, Colors.Green, Colors.Blue };

            for (int i = 0; i < names.Length; i++) {
                RadioButton radioButton = new RadioButton {
                    Content = names[i],
                    Foreground = new SolidColorBrush(colors[i]),
                    IsChecked = (txtblk.Foreground as SolidColorBrush).Color == colors[i],
                    Margin = new Thickness(12)
                };
                radioButton.Checked += OnRadioButtonChecked;
                stackPanel.Children.Add(radioButton);
            }

            // Create a Border for the StackPanel
            Border border = new Border {
                Child = stackPanel,
                Background = this.Resources["ApplicationPageBackgroundThemeBrush"] as SolidColorBrush,
                BorderBrush = this.Resources["ApplicationForegroundThemeBrush"] as SolidColorBrush,
                BorderThickness = new Thickness(1),
                Padding = new Thickness(24),
            };

            // Create the Popup object
            Popup popup = new Popup {
                Child = border,
                IsLightDismissEnabled = true
            };

            // Adjust location based on content size
            border.Loaded += (loadedSender, loadedArgs) => {
                Point point = e.GetPosition(this);
                point.X -= border.ActualWidth / 2;
                point.Y -= border.ActualHeight;

                // Leave at least a quarter inch margin
                popup.HorizontalOffset =
                    Math.Min(this.ActualWidth - border.ActualWidth - 24,
                    Math.Max(24, point.X));

                popup.VerticalOffset =
                    Math.Min(this.ActualHeight - border.ActualHeight - 24,
                    Math.Max(24, point.Y));

                // Set keyboard focus to first element
                btn1.Focus(FocusState.Programmatic);
            };

            // Open the popup
            popup.IsOpen = true;
        }
开发者ID:ronlemire2,项目名称:UWP-Testers,代码行数:74,代码来源:SimpleContextDialogPage.xaml.cs

示例15: listView_RightTapped

 private void listView_RightTapped(object sender, RightTappedRoutedEventArgs e)
 {
     if (((FrameworkElement)e.OriginalSource).DataContext != null)
     {
         selectedListViewItemStr = ((FrameworkElement)e.OriginalSource).DataContext.ToString();
         lVcontextMenu.ShowAt(listView, e.GetPosition(listView));
     }
 }
开发者ID:dziaineka,项目名称:cliche,代码行数:8,代码来源:MainPage.xaml.cs


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