# TextContextMenuEventArgs Class

> The WPF.TextContextMenuEventArgs class provides data for the WPF.TextControl.TextContextMenuOpening event. This event occurs, immediately before a built-in context menu will be opened. A TextControl provides context menus for different parts of a document. The ContextMenuLocation property informs for which part the menu will be opened. The pre-defined menu provided with the TextContextMenu property can be altered or expanded.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 19.0
- **Namespace:** `TXTextControl.WPF`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.WPF.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.WPF.dll` from the setup
- **Inherits:** `System.ComponentModel.CancelEventArgs`
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl.WPF > TextContextMenuEventArgs Class
- **798 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/llms-full.txt

---

### Description

The WPF.TextContextMenuEventArgs class provides data for the [WPF.TextControl.TextContextMenuOpening](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/textcontextmenuopening-event/llms-full.txt) event. This event occurs, immediately before a built-in context menu will be opened. A TextControl provides context menus for different parts of a document. The [ContextMenuLocation](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/contextmenulocation-property/llms-full.txt) property informs for which part the menu will be opened. The pre-defined menu provided with the [TextContextMenu](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/textcontextmenu-property/llms-full.txt) property can be altered or expanded.

### Syntax

```csharp
public class TextContextMenuEventArgs : CancelEventArgs
```

```vbnet
Public Class TextContextMenuEventArgs
    Inherits CancelEventArgs
```

### Examples

The following example includes the context menu location value from a Text Context Menu Event Args object in application diagnostics. The created object is then available to the surrounding document workflow.

```csharp
Console.WriteLine($"Context Menu Location: {textContextMenuEventArgs.ContextMenuLocation}");
Console.WriteLine("Text Context Menu Event Args is ready for use.");
```

```vbnet
Console.WriteLine($"Context Menu Location: {textContextMenuEventArgs.ContextMenuLocation}")
Console.WriteLine("Text Context Menu Event Args is ready for use.")
```

---

## In This Section

- [TextContextMenuEventArgs.ContextMenuLocation Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/contextmenulocation-property/llms-full.txt): Gets the location in the document for which the context menu will be opened. The context menu items, which will be shown, depend on this location. The property value can be a combination (bitwise or) of the ContextMenuLocation values.
- [TextContextMenuEventArgs.HorizontalOffset Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/horizontaloffset-property/llms-full.txt): Gets the horizontal distance between the top-left corner of the screen and the location where the menu is displayed.
- [TextContextMenuEventArgs.TextContextMenu Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/textcontextmenu-property/llms-full.txt): Gets or sets the context menu, which will be shown. The items depend on the document location where the mouse click occurs. The menu can be altered, extended or completely replaced. When this property is set to null, the WPF.TextControl uses system menu items. To completely suppress a context menu, the Cancel Property must be set the true.
- [TextContextMenuEventArgs.VerticalOffset Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/verticaloffset-property/llms-full.txt): Gets the vertical distance between the top-left corner of the screen and the location where the menu is displayed.

---

## Nearby

- **Previous:** [StatusBarColors.SeparatorColorLight Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/statusbarcolors/separatorcolorlight-property/llms-full.txt)
- **Next:** [TextContextMenuEventArgs.ContextMenuLocation Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontextmenueventargs/contextmenulocation-property/llms-full.txt)
