The package is unvell.ReoGrid.One.Wpf and the namespace is unvell.ReoGrid.Wpf. Drawing goes through DrawingContext / FormattedText (WpfGraphics).

For getting started and sample code, see WPF Quick Start.

Structure

ReoGridControl derives from Panel. The grid itself is drawn in OnRender, and the scrollbars, the cell editor and the dropdown ride on top as child elements.

Coordinate system

WPF’s DIP is based on 96 DPI, which matches the core’s logical pixel. There is therefore no equivalent of the WinForms build’s DpiScale conversion, and per-monitor DPI is handled by the framework.

Borders are drawn crisply thanks to EdgeMode.Aliased and SnapsToDevicePixels. Brushes, pens and typefaces are frozen and cached.

Members

The same names and meanings as the WinForms build.

CategoryMembers
WorkbookWorkbook ActiveWorksheet SetWorksheet LoadWorkbook NewWorkbook LoadJson
SelectionSelection ActiveCell SelectionChanged
EditingBeginEdit CancelEdit IsEditing SetActiveCellInput and more
HistoryUndo Redo CanUndo CanRedo HistoryChanged
DisplayZoom ZoomChanged SetFreeze
EventsWorkbookChanged ActiveSheetChanged ContextMenuRequested CellButtonClicked

The bulk operations on a selection line up under the same names too (Selection and the Active Cell).

Printing

control.Print();
control.Print(new PrintSettings { /* ... */ });

It builds a DocumentPaginator internally and passes it to the print dialog. Where the WinForms build returns a PrintDocument, the WPF build’s method does the printing.

Rendering to an arbitrary DrawingContext

control.RenderTo(drawingContext, width, height, pixelsPerDip);

Japanese input (IME)

The implementation reassociates the IMM32 context to receive WM_IME_* messages, matching the WinForms build. Starting Japanese input on a cell that is not being edited opens the editor in place.

Differences from the WinForms build

WinFormsWPF
Base classControlPanel
DPI conversionapplies DpiScalenone needed (DIP = logical pixel)
Zoommultiplied into RenderScalea ScaleTransform
Printingreturns a PrintDocumentPrint() does it
Drawing targetSystem.Drawing.GraphicsDrawingContext
Was this article helpful?