> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# RenderTarget

## Definition

A **SharpDX Direct2D1 RenderTarget** creates objects and exposes methods used for drawing in the chart area.

Notes:

1. There are two RenderTarget's used in a chart. This is important to understand when creating/destroying device resources. Please see the [OnRenderTargetChanged()](/developer/desktop-sdk/references/common/charts/rendering/onrendertargetchanged) page for more information.
2. For a walk through for using the SharpDX RenderTarget, please see the educational resource [Using SharpDX for Custom Chart Rendering](/developer/desktop-sdk/guides/educational-resources/using-sharpdx-for-custom-chart-rendering).

## Property Value

A [SharpDX.Direct2D1.RenderTarget](/developer/desktop-sdk/references/sharpdx/sharpdx-direct2d1/sharpdx-direct2d1-rendertarget)

| Property                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **SharpDX.Direct2D1.WindowRenderTarget** | Used to render the actual contents of the chart to the window                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **SharpDX.Direct2D1.WicRenderTarget**    | Used to render a bitmap for a few scenarios: 1. A user clicks on a chart area; a bitmap is used to do any hit detection to determine where the user clicked. 2. User clicks on the Windows task bar; a bitmap is used to render the preview of the contents of the chart display through a thumbnail on the task bar. 3. A user re-sizes the chart; a bitmap is used to render the current contents of the chart, which is redrawn using the WindowRenderTarget after the desired changes have been set. |

## Syntax

`RenderTarget`

Warning: Each DirectX render target requires its own brushes. You must create brushes directly in [OnRender()](/developer/desktop-sdk/references/common/charts/rendering/onrender) or using [OnRenderTargetChanged()](/developer/desktop-sdk/references/superdom-column/onrestorevalues). If you do not, you will receive an error at run time similar to:

"A direct X error has occurred while rendering the chart: HRESULT: \[0x88990015], Module: \[SharpDX.Direct2D1], ApiCode: \[D2DERR\_WRONG\_RESOURCE\_DOMAIN/WrongResourceDomain], Message: The resource was realized on the wrong render target. : Each DirectX render target requires its own brushes. You must create brushes directly in OnRender() or using OnRenderTargetChanged().

Please see [OnRenderTargetChanged()](/developer/desktop-sdk/references/common/charts/rendering/onrendertargetchanged) for examples with brushes that need to be recalculated, or [OnRender()](/developer/desktop-sdk/references/common/charts/rendering/onrender) for an example of recreating a static brush.