RenderSurface
What RenderSurface is
RenderSurface is a WPF-hosted control that reserves a rectangular region of the screen for custom MonoGame rendering. From the layout tree's perspective it is just another control: it takes up space, participates in sizing, and can be positioned like anything else. From the rendering perspective it is a portal into the MonoGame world.
It does not try to be a general-purpose canvas or a replacement for WPF's built-in drawing primitives. Its job is narrowly defined: hand off a bounded region of pixels to code that knows how to fill them using MonoGame.
The two sides it connects
Every InkkSlinger application has two distinct rendering concerns living in the same window.
The UI side is handled by the WPF-style layout tree. Controls, panels, labels, buttons, and bindings all live here. This side is declarative and data-driven.
The game side is handled by MonoGame. Sprites, textures, cameras, draw calls, and frame-by-frame update logic all live here. This side is imperative and frame-driven.
RenderSurface sits at the boundary between them. It gives the layout tree a stable, measurable slot while giving MonoGame a surface it can draw into each frame.
From the layout tree
A normal control with a size, alignment, and position. It participates in measure and arrange the same way any other element does.
From MonoGame
A render target with known dimensions. Each frame, MonoGame draws into this target and the result appears inside the control's bounds.
What it is not
- It is not a general drawing API. You do not call drawing methods on it directly.
- It is not a replacement for WPF shapes or drawing visuals. Use those for UI-level graphics.
- It is not aware of your game logic. It only owns the pixel region and the handoff contract.
One control, one region. Each RenderSurface instance owns exactly one rectangular region. If you need multiple independent rendered viewports, place multiple instances in the layout tree.