private void ContextMenu_Showing(object sender, ContextMenuEventArgs e) { var textFormatting = e.ContextMenuGroupCollection.FirstOrDefault(x => x.Type == ContextMenuGroupType.FloatingBlockCommands); if (textFormatting != null) { e.ContextMenuGroupCollection.Remove(textFormatting); } }
public void linkfrom_init(object sender, ContextMenuEventArgs e) { linkfrom = getUnitDialogueFromButton(sender); }
// Token: 0x06006FD7 RID: 28631 RVA: 0x00202514 File Offset: 0x00200714 internal static void OnContextMenuOpening(FlowDocument document, Control viewer, ContextMenuEventArgs e) { ContextMenu contextMenu = null; if (e.TargetElement != null) { contextMenu = (e.TargetElement.GetValue(FrameworkElement.ContextMenuProperty) as ContextMenu); } if (contextMenu == null) { contextMenu = viewer.ContextMenu; } if (contextMenu != null) { if (document != null && DoubleUtil.LessThan(e.CursorLeft, 0.0)) { ITextContainer textContainer = (ITextContainer)((IServiceProvider)document).GetService(typeof(ITextContainer)); ITextPointer textPointer = null; if (textContainer.TextSelection != null) { if ((textContainer.TextSelection.IsEmpty || !textContainer.TextSelection.TextEditor.UiScope.IsFocused) && e.TargetElement is TextElement) { textPointer = ((TextElement)e.TargetElement).ContentStart; } else { textPointer = textContainer.TextSelection.Start.CreatePointer(LogicalDirection.Forward); } } else if (e.TargetElement is TextElement) { textPointer = ((TextElement)e.TargetElement).ContentStart; } ITextView textView = textContainer.TextView; if (textPointer != null && textView != null && textView.IsValid && textView.Contains(textPointer)) { Rect rect = textView.GetRectangleFromTextPosition(textPointer); if (rect != Rect.Empty) { rect = DocumentViewerHelper.CalculateVisibleRect(rect, textView.RenderScope); if (rect != Rect.Empty) { GeneralTransform generalTransform = textView.RenderScope.TransformToAncestor(viewer); Point point = generalTransform.Transform(rect.BottomLeft); contextMenu.Placement = PlacementMode.Relative; contextMenu.PlacementTarget = viewer; contextMenu.HorizontalOffset = point.X; contextMenu.VerticalOffset = point.Y; contextMenu.IsOpen = true; e.Handled = true; } } } } if (!e.Handled) { contextMenu.ClearValue(ContextMenu.PlacementProperty); contextMenu.ClearValue(ContextMenu.PlacementTargetProperty); contextMenu.ClearValue(ContextMenu.HorizontalOffsetProperty); contextMenu.ClearValue(ContextMenu.VerticalOffsetProperty); } } }
internal virtual void OnWebHostContextMenuShown(object sender, ContextMenuEventArgs e) { }
void TreeView_ContextMenuOpening(object sender, ContextMenuEventArgs e) { ApplyContextMenuBinding <TreeViewItem>(sender, e); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListView_ContextMenuOpening(object sender, ContextMenuEventArgs e) { ListViewContextMenu.Tag = ((FrameworkElement)e.OriginalSource).DataContext as TaskInfo; }
protected virtual void textBox1_ContextMenuOpening(object sender, ContextMenuEventArgs e) { }
void webControl1_ShowContextMenu(object sender, ContextMenuEventArgs e) { e.Handled = true; }
private void InputBox_ContextMenuOpening(object sender, ContextMenuEventArgs e) => e.Handled = true;
/// <summary> /// Выделить поле окна авторизации /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DialogWindowLogin_ContextMenuOpening(object sender, ContextMenuEventArgs e) { loginNameTextBox.Focus(); }
/// <summary> /// Neccessary so the Layoutonmouse Enter only occurs once after the Contextmenue being opened. /// Contextmenu Opening could not be used since it needs the menu to be initialized already and then starts to redo it /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrameworkElement_OnContextMenuClosing(object sender, ContextMenuEventArgs e) { gotClicked = false; }
void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e) { ApplyContextMenuBinding <ListBoxItem>(sender, e); }
private void Browser_ShowContextMenu(object sender, ContextMenuEventArgs e) { e.Handled = true; }
//Disable the context menu in Awesomium private void BattlelogShowContextMenu(object sender, ContextMenuEventArgs e) { e.Handled = true; }
private void TileContextMenu_ContextMenuOpening(object sender, ContextMenuEventArgs e) { UpdateTilesContextMenu(); }
/// <summary> /// 右键菜单展开 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnContextMenuOpen(object sender, ContextMenuEventArgs e) { //XamlUtil.SelectRow(DnsRecordDataGrid, e); }
private void TreeFolderBrowser_ContextMenuOpening(object sender, ContextMenuEventArgs e) { FolderBrowserContextMenu.ShowContextMenu(); }
void TextAreaContextMenuOpening(object sender, ContextMenuEventArgs e) { ITextEditor adapter = GetAdapterFromSender(sender); MenuService.ShowContextMenu(sender as UIElement, adapter, contextMenuPath); }
private static void TextBoxOnContextMenuOpening(object sender, ContextMenuEventArgs e) { var textBoxBase = sender as TextBoxBase; ContextMenu contextMenu = textBoxBase?.ContextMenu; if (contextMenu == null) { return; } RemoveSpellingSuggestions(contextMenu); if (!SpellCheck.GetIsEnabled(textBoxBase)) { return; } SpellingError spellingError = GetSpellingError(textBoxBase); if (spellingError != null) { Style spellingSuggestionStyle = contextMenu.TryFindResource(Spelling.SuggestionMenuItemStyleKey) as Style; int insertionIndex = 0; bool hasSuggestion = false; foreach (string suggestion in spellingError.Suggestions) { hasSuggestion = true; var menuItem = new MenuItem { CommandTarget = textBoxBase, Command = EditingCommands.CorrectSpellingError, CommandParameter = suggestion, Style = spellingSuggestionStyle, Tag = typeof(Spelling) }; contextMenu.Items.Insert(insertionIndex++, menuItem); } if (!hasSuggestion) { contextMenu.Items.Insert(insertionIndex++, new MenuItem { Style = contextMenu.TryFindResource(Spelling.NoSuggestionsMenuItemStyleKey) as Style, Tag = typeof(Spelling) }); } contextMenu.Items.Insert(insertionIndex++, new Separator { Style = contextMenu.TryFindResource(Spelling.SeparatorStyleKey) as Style, Tag = typeof(Spelling) }); contextMenu.Items.Insert(insertionIndex++, new MenuItem { Command = EditingCommands.IgnoreSpellingError, CommandTarget = textBoxBase, Style = contextMenu.TryFindResource(Spelling.IgnoreAllMenuItemStyleKey) as Style, Tag = typeof(Spelling) }); contextMenu.Items.Insert(insertionIndex, new Separator { Style = contextMenu.TryFindResource(Spelling.SeparatorStyleKey) as Style, Tag = typeof(Spelling) }); } }
private void OnContextMenuOpening(object sender, ContextMenuEventArgs e) { if (selectedItem != null && selectedItem.ItemData.ID != 0) { if (HasSelection) { selectionIsImportant = -1; selectionMax = 0; bool roomInCollection = false; bool unknownItem = false; ItemTypes itemType = SelectedItems[0].ItemData.PocketType; selectionExclusives = GameTypeFlags.AllGen3; foreach (Item item in SelectedItems) { selectionExclusives &= item.ItemData.Exclusives; selectionMax = Math.Max(selectionMax, (int)item.Count); if (item.ItemData.ID == 0) { unknownItem = true; } else if (item.ItemData.IsImportant) { if (selectionIsImportant == -1) { selectionIsImportant = 1; } else if (selectionIsImportant == 0) { selectionIsImportant = 2; } if (PokeManager.ManagerGameSave.Inventory.Items[item.ItemData.PocketType].GetCountOfID(item.ID) == 0) { roomInCollection = true; } } else { if (selectionIsImportant == -1) { selectionIsImportant = 0; } else if (selectionIsImportant == 1) { selectionIsImportant = 2; } } if (item.ItemData.PocketType != itemType) { itemType = ItemTypes.Unknown; } } ((MenuItem)contextMenu.Items[0]).Header = (pocket.PocketType == ItemTypes.PC ? "Withdraw" : "Deposit"); ((MenuItem)contextMenu.Items[1]).Header = (pocket.PocketType == ItemTypes.PC ? "Withdraw All" : "Deposit All"); ((MenuItem)contextMenu.Items[2]).Header = (selectionIsImportant == 1 ? "Add to Collection" : "Send To"); ((MenuItem)contextMenu.Items[0]).IsEnabled = !unknownItem && selectionIsImportant == 0 && pocket.Inventory.ContainsPocket(ItemTypes.PC); ((MenuItem)contextMenu.Items[1]).IsEnabled = !unknownItem && selectionIsImportant == 0 && pocket.Inventory.ContainsPocket(ItemTypes.PC); ((MenuItem)contextMenu.Items[2]).IsEnabled = !unknownItem && itemType != ItemTypes.Unknown && (selectionIsImportant == 0 || (roomInCollection && selectionIsImportant == 1)); ((MenuItem)contextMenu.Items[3]).IsEnabled = false; ((MenuItem)contextMenu.Items[5]).IsEnabled = !unknownItem && (selectionIsImportant == 0 || pocket.GameSave.GameIndex == -1); ((MenuItem)contextMenu.Items[6]).IsEnabled = !unknownItem && (selectionIsImportant == 0 || pocket.GameSave.GameIndex == -1); } else { ((MenuItem)contextMenu.Items[0]).Header = (pocket.PocketType == ItemTypes.PC ? "Withdraw" : "Deposit"); ((MenuItem)contextMenu.Items[1]).Header = (pocket.PocketType == ItemTypes.PC ? "Withdraw All" : "Deposit All"); ((MenuItem)contextMenu.Items[2]).Header = (selectedItem.ItemData.IsImportant ? "Add to Collection" : "Send To"); ((MenuItem)contextMenu.Items[0]).IsEnabled = !selectedItem.ItemData.IsImportant && pocket.Inventory.ContainsPocket(ItemTypes.PC); ((MenuItem)contextMenu.Items[1]).IsEnabled = !selectedItem.ItemData.IsImportant && pocket.Inventory.ContainsPocket(ItemTypes.PC); ((MenuItem)contextMenu.Items[2]).IsEnabled = (!selectedItem.ItemData.IsImportant || PokeManager.ManagerGameSave.Inventory.Items[selectedItem.ItemData.PocketType].GetCountOfID(selectedItem.ID) == 0); ((MenuItem)contextMenu.Items[3]).IsEnabled = !selectedItem.ItemData.IsImportant && (selectedItem.ID < 121 || (selectedItem.ID > 132 && selectedItem.ID < 500)); ((MenuItem)contextMenu.Items[5]).IsEnabled = (!selectedItem.ItemData.IsImportant || pocket.GameSave.GameIndex == -1); ((MenuItem)contextMenu.Items[6]).IsEnabled = (!selectedItem.ItemData.IsImportant || pocket.GameSave.GameIndex == -1); } } else { ((MenuItem)contextMenu.Items[0]).IsEnabled = false; ((MenuItem)contextMenu.Items[1]).IsEnabled = false; ((MenuItem)contextMenu.Items[2]).IsEnabled = false; ((MenuItem)contextMenu.Items[3]).IsEnabled = false; ((MenuItem)contextMenu.Items[5]).IsEnabled = false; ((MenuItem)contextMenu.Items[6]).IsEnabled = false; } }
private void ContentControl_ContextMenuOpening(object sender, ContextMenuEventArgs e) { var control = sender as ContentControl; control.ContextMenu.DataContext = control.DataContext; }
private void menu_ContextMenuOpening(object sender, ContextMenuEventArgs e) { menuDock.Visibility = Visibility.Visible; }
private void About_ContextMenuOpening(object sender, ContextMenuEventArgs e) { e.Handled = true; }
/// <summary> /// Подстановка имени столбца при открытии контексного меню фильтрации DataGrid, /// установка Tag и перемещение фокуса ввода в поле /// </summary> private void PageDataGrid_OnContextMenuOpening(object senderIsDataGrid, ContextMenuEventArgs eventArgs) { PageUtil.Service_PageDataGridWithFilterContextMenuOpening(senderIsDataGrid); }
/// <inheritdoc /> protected override void OnContextMenuClosing(ContextMenuEventArgs e) { this.InvalidateProperty(ContextMenuProperty); base.OnContextMenuClosing(e); }
internal bool ProcessContextMenuOpening(ContextMenuEventArgs e) { bool overCloseButton = false; int tabIndex = TabIndexFromOffset(e.CursorLeft, ref overCloseButton); if (-1 == tabIndex) e.Handled = true; return e.Handled; // The tab visual has handled the message. }
internal static void InputBox_ContextMenuOpening(object sender, ContextMenuEventArgs e) => e.Handled = true;
private void WorkBench_ContextMenuOpening(object sender, ContextMenuEventArgs e) { }
private void ListChangedItems_ContextMenuOpening(object sender, ContextMenuEventArgs e) { var selected = ListChangedItems.SelectedItem as RepositoryStatusItem; if (selected == null) { return; } //<MenuItem Header="Ignore File" Click="MenuIgnoreFile_Click"/> //<MenuItem Header="Undo Changes" Click="MenuUndoFile_Click" /> //<MenuItem Header="Delete File" Click="MenuDeleteFile_Click" /> //<Separator /> //<MenuItem Header="Open in external Diff tool" Click="MenuOpenDiffTool_Click"/> //<MenuItem Header="Open in Explorer" Click="MenuOpenInExplorer_Click" /> var ctx = new ContextMenu(); e.Handled = true; var mi = new MenuItem { Header = "Ignore File" }; mi.Click += MenuIgnoreFile_Click; ctx.Items.Add(mi); if (selected.FileStatus != FileStatus.NewInWorkdir && selected.FileStatus != FileStatus.NewInIndex) { mi = new MenuItem { Header = "Undo Changes" }; mi.Click += MenuUndoFile_Click; ctx.Items.Add(mi); } if (selected.FileStatus != FileStatus.DeletedFromWorkdir && selected.FileStatus != FileStatus.DeletedFromIndex) { mi = new MenuItem { Header = "Delete File" }; mi.Click += MenuDeleteFile_Click; ctx.Items.Add(mi); } ctx.Items.Add(new Separator()); if (selected.FileStatus != FileStatus.NewInIndex && selected.FileStatus != FileStatus.NewInWorkdir) { mi = new MenuItem { Header = "Open in external Diff Tool" }; mi.Click += MenuOpenDiffTool_Click; ctx.Items.Add(mi); } mi = new MenuItem { Header = "Open in Explorer" }; mi.Click += MenuOpenInExplorer_Click; ctx.Items.Add(mi); if (!string.IsNullOrEmpty(CommitModel.Remote)) { using (var repo = CommitModel.GitHelper.OpenRepository(CommitModel.Filename)) { var remoteUrl = repo?.Network.Remotes.FirstOrDefault()?.Url; if (remoteUrl != null && remoteUrl.Contains("github.com")) { mi = new MenuItem { Header = "Open on Github" }; mi.Click += MenuOpenInRemote_Click; ctx.Items.Add(mi); } } } ListChangedItems.ContextMenu = ctx; ListChangedItems.ContextMenu.IsOpen = true; }
public override void ShowContextMenu(ContextMenuEventArgs e) { MenuService.ShowContextMenu(null, model, "/SharpDevelop/Pads/ClassBrowser/AssemblyReferencesContextMenu"); }
void ProfileTaskList_ContextMenuOpening(object sender, ContextMenuEventArgs e) { throw new NotImplementedException(); }
private void ChunksContextMenu_ContextMenuOpening(object sender, ContextMenuEventArgs e) { UpdateChunksContextMenu(); }
/// <summary> /// The context menu is over the drop-down PowerItems. /// So what we are doing is setting the data context for that menu /// to the PowerItem clicked. /// </summary> private void ContextMenuContextMenuOpening(object sender, ContextMenuEventArgs e) { App.Current.MenuDataContext = Util.ExtractRelatedPowerItem(e); }
private void PokemonsListView_ContextMenuOpening(object sender, ContextMenuEventArgs e) { }
//</SnippetAddItemNoHandle> //<SnippetReplaceNoReopen> void HandlerForCMO(object sender, ContextMenuEventArgs e) { FrameworkElement fe = e.Source as FrameworkElement; fe.ContextMenu = BuildMenu(); }
/// <summary> /// Called when ContextMenuOpening is raised on this element. /// </summary> /// <param name="e">Event arguments</param> protected override void OnContextMenuOpening(ContextMenuEventArgs e) { base.OnContextMenuOpening(e); if (e.Handled) { return; } if (_textEditor != null) { _textEditor.OnContextMenuOpening(e); } }
private void WebKit_ShowContextMenu(Window window, ContextMenuEventArgs args) { var menu = new ContextMenuStrip(); if (!string.IsNullOrEmpty(args.LinkUrl)) { menu.Items.Add("&Open Link", null, (s, e) => Window.NavigateTo(args.LinkUrl) ); menu.Items.Add("Copy Link Address", null, (s, e) => { Clipboard.Clear(); Clipboard.SetText(args.LinkUrl); } ); menu.Items.Add("-"); } if (args.IsEditable || !string.IsNullOrEmpty(args.SelectedText)) { menu.Items.Add( "&Undo", null, (s, e) => Window.Undo() ).Enabled = (args.EditFlags & EditFlags.CanUndo) == EditFlags.CanUndo; menu.Items.Add( "&Redo", null, (s, e) => Window.Redo() ).Enabled = (args.EditFlags & EditFlags.CanRedo) == EditFlags.CanRedo; menu.Items.Add("-"); menu.Items.Add( "Cu&t", null, (s, e) => Window.Cut() ).Enabled = (args.EditFlags & EditFlags.CanCut) == EditFlags.CanCut; menu.Items.Add( "&Copy", null, (s, e) => Window.Copy() ).Enabled = (args.EditFlags & EditFlags.CanCopy) == EditFlags.CanCopy; menu.Items.Add( "&Paste", null, (s, e) => Window.Paste() ).Enabled = (args.EditFlags & EditFlags.CanPaste) == EditFlags.CanPaste; menu.Items.Add( "&Delete", null, (s, e) => Window.DeleteSelection() ).Enabled = (args.EditFlags & EditFlags.CanDelete) == EditFlags.CanDelete; } else { menu.Items.Add("&Back", null, (s, e) => Window.GoBack() ).Enabled = Window.CanGoBack; menu.Items.Add("&Forward", null, (s, e) => Window.GoForward() ).Enabled = Window.CanGoForward; menu.Items.Add("&Reload", null, (s, e) => Window.Refresh() ).Enabled = !IsLoading; menu.Items.Add("&Stop", null, (s, e) => Window.Stop() ).Enabled = IsLoading; } menu.Items.Add("-"); menu.Items.Add( "Select &All", null, (s, e) => Window.SelectAll() ).Enabled = (args.EditFlags & EditFlags.CanSelectAll) == EditFlags.CanSelectAll; switch (args.MediaType) { case MediaType.Image: menu.Items.Add("-"); menu.Items.Add( "Copy Image URL", null, (s, e) => Clipboard.SetText(args.SrcUrl) ); break; default: break; } menu.Items.Add("-"); menu.Items.Add("View Page Source", null, (s, e) => Window.NavigateTo("viewsource:" + args.PageUrl) ); menu.Closed += (s, e) => this.BeginInvoke((Action)(() => menu.Dispose())); menu.Show(this, args.MouseX, args.MouseY); }