# Format Code Block Dialog

This dialog allows you to insert and edit [code blocks](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/features/code-block) in the document.

![An image showing the format code block dialog of RadRichTextBox for WPF](https://www.telerik.com/products/wpf/documentation/assets/601553942b50d6ef8980cd4f1a8a9a7f/richtextbox-dialogs-format-code-block-0.png)

The dialog can be opened from the **Code** button in the **Insert** tab of the [RadRichTextBoxRibbonUI](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/ui-for-applying-rich-text-formatting/features-radrichtextboxribbonui) or via the in the same option in the right-click menu (context menu) of `RadRichTextBox`.

![An image showing the button that opens the format code block dialog of RadRichTextBox for WPF](https://www.telerik.com/products/wpf/documentation/assets/ddff77713a078650d4058509ca3d6e38/richtextbox-dialogs-format-code-block-1.png)

![An image showing the context menu that opens the format code block dialog of RadRichTextBox for WPF](https://www.telerik.com/products/wpf/documentation/assets/6f974fdc3442c99a1dee6a1532451fcc/richtextbox-dialogs-format-code-block-2.png)

## Showing the Dialog Manually

The dialog can be shown by executing the `ShowCodeFormattingDialogCommand`. See how to bind the command to an external button in the [Commands](https://www.telerik.com/products/wpf/documentation/controls/radrichtextbox/features/commands) article.

**Executing the show dialog command**

```C#
	this.richTextBox.Commands.ShowCodeFormattingDialogCommand.Execute(null);
```

Alternatively, call the `ShowCodeFormattingDialog` method of `RadRichTextBox`.

**Using the show dialog method**

```C#
	this.richTextBox.ShowCodeFormattingDialog();
```
