當前位置: 首頁>>代碼示例>>C#>>正文


C# HoldingRoutedEventArgs.GetPosition方法代碼示例

本文整理匯總了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());
 }
開發者ID:tomazio21,項目名稱:DocFingerPrinterBeta,代碼行數:7,代碼來源:FilesPage.xaml.cs

示例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));          
 }
開發者ID:akshay2000,項目名稱:MonocleGiraffe,代碼行數:9,代碼來源:ImageUserControl.xaml.cs

示例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();
     }
 }
開發者ID:Opiumtm,項目名稱:DvachBrowser3,代碼行數:11,代碼來源:PopupLogicHelper.cs

示例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();
                }
            }
        }
開發者ID:SuperMap,項目名稱:iClient-WP8-Example,代碼行數:19,代碼來源:CustomClientMeasure.xaml.cs

示例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);
     }
 }
開發者ID:eugeniopacceli,項目名稱:Baconit,代碼行數:14,代碼來源:BasicImageContentPanel.xaml.cs

示例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);
        }
開發者ID:hirokuma3,項目名稱:Windows-universal-samples,代碼行數:27,代碼來源:Scenario1.xaml.cs

示例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);
            }
        }
開發者ID:SuperMap,項目名稱:iClient-for-Win8,代碼行數:25,代碼來源:DrawLine.cs

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

            }
        }
開發者ID:GJian,項目名稱:UWP-master,代碼行數:20,代碼來源:DataGridTouchMethods.cs

示例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);
        }
開發者ID:ThePublicBikeGang,項目名稱:EasyBike,代碼行數:18,代碼來源:MainPage.xaml.cs

示例10: TranslationItemHolding

 private void TranslationItemHolding(object sender, HoldingRoutedEventArgs e)
 {
     if (!_isShowingContextMenu)
     {
         _isShowingContextMenu = true;
         TranslationItemHoldingOrRightTapped(sender, e.GetPosition(null), e.OriginalSource);
     }
 }
開發者ID:hubaishan,項目名稱:quran-phone,代碼行數:8,代碼來源:DetailsView.xaml.cs

示例11: ImageHolding

 private async void ImageHolding(object sender, HoldingRoutedEventArgs e)
 {
     if (!_isShowingContextMenu)
     {
         _isShowingContextMenu = true;
         await ImageHoldingOrRightTapped(sender, (ui) => { return e.GetPosition(ui); });
     }
 }
開發者ID:hubaishan,項目名稱:quran-phone,代碼行數:8,代碼來源:DetailsView.xaml.cs

示例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;
        }
開發者ID:mbin,項目名稱:Win81App,代碼行數:13,代碼來源:Scenario4.xaml.cs

示例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);
            }
        }
開發者ID:SuperMap,項目名稱:iClient-for-Win8,代碼行數:22,代碼來源:DrawPolygon.cs

示例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();
     }
               
     
 }
開發者ID:rvrtex,項目名稱:mJohnsonYouMaps,代碼行數:12,代碼來源:MapPage.xaml.cs


注:本文中的Windows.UI.Xaml.Input.HoldingRoutedEventArgs.GetPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。