private async void InkCanvas_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var inchToMillimeterFactor = 25.4f; List <Point> points = new List <Point>(); var scalingX = DpiX / inchToMillimeterFactor; var scalingY = DpiY / inchToMillimeterFactor; var xCord = e.GetPosition(inkCanvas).X / scalingX; var yCord = e.GetPosition(inkCanvas).Y / scalingY; var step = GetRelatedStep((float)xCord, (float)yCord); if (step != null) { curEditingStep = step; var fly = this.myFlyout; SetForm(); this.Type.SelectedIndex = TypeToIndex[curEditingStep.Type]; var options = new Windows.UI.Xaml.Controls.Primitives.FlyoutShowOptions() { Position = e.GetPosition(sender as UIElement) }; fly.ShowAt(sender as FrameworkElement, options); } else { // should say something? } }
private void UcEditor_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { // Only for Mouse to avoid issue with LongPress becoming RightTap with Pen/Touch if (e.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Mouse) { return; } var uiElement = sender as UIElement; var pos = e.GetPosition(uiElement); _lastPointerPosition = new Graphics.Point((float)pos.X, (float)pos.Y); _lastSelectedBlock?.Dispose(); _lastSelectedBlock = _editor.HitBlock(_lastPointerPosition.X, _lastPointerPosition.Y); if ((_lastSelectedBlock == null) || (_lastSelectedBlock.Type == "Container")) { _lastSelectedBlock?.Dispose(); _lastSelectedBlock = _editor.GetRootBlock(); } if (_lastSelectedBlock != null) { var globalPos = e.GetPosition(null); DisplayContextualMenu(globalPos); } e.Handled = true; }
private void purseList_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { ListView listView = (ListView)sender; purseListFlyoutMenu.ShowAt(listView, e.GetPosition(listView)); purseElement = ((FrameworkElement)e.OriginalSource).DataContext as Purse; }
private void SampleTreeView_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { if (e.OriginalSource is ListViewItemPresenter) { ListViewItemPresenter lvip = (ListViewItemPresenter)e.OriginalSource; lastTreeNode = (TreeNode)lvip.Content; EsSystemData data = lastTreeNode.Data as EsSystemData; if (data != null && data.ItemType == EsTreeItemType.esConnection) { if (data.IsConnect) { Menu_Open.IsEnabled = false; Menu_Close.IsEnabled = true; } else { Menu_Open.IsEnabled = true; Menu_Close.IsEnabled = false; } ItemMenuFlyout.ShowAt(sampleTreeView, e.GetPosition(sampleTreeView)); } } else if (e.OriginalSource is Grid) { //Grid grid = (Grid)e.OriginalSource; //BlankMenuFlyout.ShowAt(sampleTreeView, e.GetPosition(sampleTreeView)); } }
private void GridViewVideo_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { GridView gridView = (GridView)sender; VideoMenuFlyout.ShowAt(gridView, e.GetPosition(gridView)); _lastRightClickedVideo = (MediaFileViewModel)((FrameworkElement)e.OriginalSource).DataContext; }
private void Grid_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var ObjectPressed = (sender as Grid).DataContext as ListedItem; gv.SelectedItems.Add(ObjectPressed); context.ShowAt(sender as Grid, e.GetPosition(sender as Grid)); }
private void Scene_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var panel = sender as Grid; var flyout = panel.Resources["SceneFlyout"] as MenuFlyout; flyout.ShowAt(panel, e.GetPosition(panel)); }
/// <summary> /// Grid RightTapped event handler. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Arguments.</param> private void Grid_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { FrameworkElement element = (FrameworkElement)sender; MenuFlyout attachedFlyout = (MenuFlyout)FlyoutBase.GetAttachedFlyout(element); attachedFlyout.ShowAt(element, e.GetPosition(element)); }
private void StackPanel_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var songMenuFlyoutSubItem = new MenuFlyoutSubItem() { Text = "AddToPlayList" }; var icon = new BitmapIcon() { UriSource = new Uri("ms-appx:///Assets/Images/songGeneral.png") }; var playLists = PlayListManager.GetAllPlayLists(); foreach (var playlist in playLists) { var playListMenuFlyoutItem = new MenuFlyoutItem() { Text = playlist.Title }; playListMenuFlyoutItem.Click += AddToPlaylistMenu_ItemClick; songMenuFlyoutSubItem.Items.Add(playListMenuFlyoutItem); } var addToPlaylistFlyout = new MenuFlyout(); addToPlaylistFlyout.Items.Add(songMenuFlyoutSubItem); FrameworkElement senderElement = sender as FrameworkElement; addToPlaylistFlyout.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement)); }
private void ListViewItem_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { ListViewItem item = (ListViewItem)sender; MyAnimalList.SelectedItem = item; MyMenuFlyout.ShowAt(item, e.GetPosition(item)); }
public UwpRightClickEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs args, FormsGestures.Listener listener) { ElementPosition = element.GetXfViewFrame(); var point = args.GetPosition(element); ElementTouches = new Xamarin.Forms.Point[] { point.ToXfPoint() }; WindowTouches = new Xamarin.Forms.Point[] { element.PointInNativeAppWindowCoord(point).ToXfPoint() }; Listener = listener; }
private void StackPanel_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { if (ChatMessage.isImage) { StackPanel stackPanel = (StackPanel)sender; menuFlyout.ShowAt(stackPanel, e.GetPosition(stackPanel)); var a = ((FrameworkElement)e.OriginalSource).DataContext; } }
private void UcEditor_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var pos = e.GetPosition(UcEditor); _lastPointerPosition = new Graphics.Point((float)pos.X, (float)pos.Y); _lastSelectedBlock = _editor.HitBlock(_lastPointerPosition.X, _lastPointerPosition.Y); if (_lastSelectedBlock == null) { _lastSelectedBlock = _editor.GetRootBlock(); } if (_lastSelectedBlock != null) { var globalPos = e.GetPosition(null); DisplayContextualMenu(globalPos); e.Handled = true; } }
//--------------------------------------------------------Events:---------------------------------------------------------------------\\ #region --Events-- private void UserControl_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { if (sender is SpeechBubbleTopControl speechBubble) { if (content_cp.ContentTemplateRoot is IShowFlyoutSpeechBubbleContent flyoutSpeechBubbleContent) { flyoutSpeechBubbleContent.ShowFlyout(speechBubble, e.GetPosition(speechBubble)); } } }
private void ListViewItemRendererExt_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var listviewitem = this.Element as ListViewItemExt; if (listviewitem != null) { var location = this.TransformToVisual(null).TransformPoint(e.GetPosition(this)); var tappedEventArgs = new ItemRightTappedEventArgs(this.Element.BindingContext, new Xamarin.Forms.Point(location.X, location.Y)); listviewitem.ListView.RaiseItemRightTapped(tappedEventArgs); } }
private void UserControl_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { if (Chat is null || Chat.Chat is null) { return; } switch (Chat.Chat.chatType) { case ChatType.CHAT: chat_mfo.ShowAt(this, e.GetPosition(this)); break; case ChatType.MUC: muc_mfo.ShowAt(this, e.GetPosition(this)); break; default: break; } }
private void MainPanelGrid_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { //if (this.GruposItem.Categoria == "Agregar") //{ // flyout_menu.Hide(); //} else //{ // flyout_menu.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement)); //} flyout_menu.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement)); }
//--------------------------------------------------------Events:---------------------------------------------------------------------\\ #region --Events-- private void Grid_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { if (Chat != null) { Grid grid = (Grid)sender; switch (Chat.chatType) { case ChatType.CHAT: chat_mfo.ShowAt(grid, e.GetPosition(grid)); break; case ChatType.MUC: muc_mfo.ShowAt(grid, e.GetPosition(grid)); break; default: break; } } }
private void CustomGridRenderer_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var treeViewNode = this.DataContext as TreeViewNode; var grid = this.Element as CustomGrid; if (treeViewNode != null) { var location = this.TransformToVisual(null).TransformPoint(e.GetPosition(this)); var tappedEventArgs = new ItemRightTappedEventArgs(this.DataContext, new Xamarin.Forms.Point(location.X, location.Y)); grid.TreeView.RaiseItemRightTapped(tappedEventArgs); } }
/// <summary> /// Right click on device item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListViewDevice_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { ListView listView = sender as ListView; this.MenuFlyoutDevice.ShowAt(listView, e.GetPosition(listView)); var device = (e.OriginalSource as FrameworkElement).DataContext; if (device == null) { this.MenuFlyoutDevice.Hide(); } else { this.CurrentRightClickDevice = device as Device; } }
private void TripResultList_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var item = sender as FrameworkElement; var itinerary = (e.OriginalSource as FrameworkElement).DataContext as TripItinerary; if (itinerary == null) { itinerary = (e.OriginalSource as FrameworkElement).FindParent <TripPlanStrip.TripPlanStrip>().DataContext as TripItinerary; } if (item != null) { MenuFlyout flyout = FlyoutBase.GetAttachedFlyout(item) as MenuFlyout; ((MenuFlyoutItem)flyout.Items[0]).CommandParameter = itinerary; flyout.ShowAt(this, e.GetPosition(this)); } }
private void OtpGrid_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { /* if (e.OriginalSource.GetType() != typeof(Grid)) * { * if(e.OriginalSource.GetType()==typeof(GridViewItem)) * { * clicked_item = ((GridViewItem)e.OriginalSource).Content as ObserverbleOtp; * } * else * { * clicked_item = (e.OriginalSource as FrameworkElement)?.DataContext as ObserverbleOtp; * } * Debug.WriteLine(clicked_item.Code); * //Debug.WriteLine(((FrameworkElement)e.OriginalSource).DataContext); * MenuFlyout myFlyout = new MenuFlyout(); * var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); * MenuFlyoutItem firstItem = new MenuFlyoutItem { Text = resourceLoader.GetString("copy")}; * MenuFlyoutItem secondItem = new MenuFlyoutItem { Text = resourceLoader.GetString("edit") }; * myFlyout.Items.Add(firstItem); * myFlyout.Items.Add(secondItem); * * //if you only want to show in left or buttom * //myFlyout.Placement = FlyoutPlacementMode.Left; * * FrameworkElement senderElement = sender as FrameworkElement; * * //the code can show the flyout in your mouse click * myFlyout.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement)); * } * }*/ var orig = e.OriginalSource as DependencyObject; while (orig != null && orig != OtpGrid) { var lv = orig as GridViewItem; if (lv != null) { var res1 = (lv.Content as ObserverbleOtp); clicked_item = res1; MenuFlyout.ShowAt(OtpGrid, e.GetPosition(OtpGrid)); break; } orig = VisualTreeHelper.GetParent(orig); } }
public void ShowTheMenu(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { var listview = sender as ListView; MenuFlyout myFlyout = new MenuFlyout(); MenuFlyoutItem firstItem = new MenuFlyoutItem { Text = "Copy ID" }; MenuFlyoutItem secondItem = new MenuFlyoutItem { Text = "Copy URL" }; MenuFlyoutItem thirdItem = new MenuFlyoutItem { Text = "Open in the browser" }; firstItem.Click += FirstItem_Click; secondItem.Click += SecondItem_Click; thirdItem.Click += ThirdItem_Click; myFlyout.Items.Add(firstItem); myFlyout.Items.Add(secondItem); myFlyout.Items.Add(thirdItem); SelectItem = ((FrameworkElement)e.OriginalSource).DataContext as SoCase; myFlyout.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement)); }
private void gridView_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { if (ApiKeys.AppCenter != null) { Microsoft.AppCenter.Analytics.Analytics.TrackEvent("RightClick Repo"); } var senderElement = sender as GridView; var repo = ((FrameworkElement)e.OriginalSource).DataContext as Repo; if (senderElement == null || repo == null) { return; } MenuFlyout myFlyout = new MenuFlyout(); Style s = new Style { TargetType = typeof(MenuFlyoutPresenter) }; s.Setters.Add(new Setter(RequestedThemeProperty, ElementTheme.Dark)); myFlyout.MenuFlyoutPresenterStyle = s; var el = new MenuFlyoutItem { Text = "Share", Icon = new SymbolIcon(Symbol.Share) }; el.Click += (sen, ee) => { SharingUrl = repo.html_url; DataTransferManager.ShowShareUI(); }; myFlyout.Items.Add(el); el = new MenuFlyoutItem { Text = "Open in browser", Icon = new SymbolIcon(Symbol.World) }; el.Click += async(sen, ee) => { await Windows.System.Launcher.LaunchUriAsync(new Uri(repo.html_url)); }; myFlyout.Items.Add(el); if (ApiHandler.AllCategories.Count == 1) { myFlyout.ShowAt(senderElement, e.GetPosition(senderElement)); return; } #region MoveTo Flyout var tempCategoriesId = new System.Collections.Generic.List <int>(repo.CategoriesId); var menu = new MenuFlyoutSubItem { Text = "Move to" }; foreach (var item in ApiHandler.AllCategories) { if (item.Id == 0) { continue; } el = new ToggleMenuFlyoutItem { Text = item.Text, Tag = item.Id.ToString(), IsChecked = tempCategoriesId.Contains(item.Id) }; el.Click += El_Click; menu.Items.Add(el); } myFlyout.Items.Add(menu); async void El_Click(object sen, RoutedEventArgs ee) { var tag = (sen as FrameworkElement).Tag; try { if (tag == null) { throw new Exception(); } var inx = Convert.ToInt32(tag.ToString()); if (tempCategoriesId.Contains(inx)) { //toggle off if (currentTabId == inx) { Repositories.Remove(repo); } tempCategoriesId.Remove(inx); } else { //toggle on tempCategoriesId.Add(inx); } repo.CategoriesId = tempCategoriesId.ToArray(); await ApiHandler.UpdateRepoAsync(User.login, repo); MainPage.NotifyElement.Show("✔ Categories Updated", 3000); } catch { MainPage.NotifyElement.Show("Something is not right!!", 2000); } } myFlyout.ShowAt(senderElement, e.GetPosition(senderElement)); #endregion }
private void mainplayer_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { mainmenu.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement)); }
private void PhotoAlbumViewer_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { gridContext.ShowAt(sender as Grid, e.GetPosition(sender as Grid)); }
public UwpRightClickEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs args, FormsGestures.Listener listener) { ViewPosition = element.GetXfViewFrame(); Touches = new Xamarin.Forms.Point[] { args.GetPosition(element).ToXfPoint() }; Listener = listener; }
private void UserControl_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e) { ShowFlyout(this, e.GetPosition(this)); }