FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add DrawingRenderContext by IngeborgAtRS · Pull Request #2168 · oxyplot/oxyplot · GitHub

Repository navigation

Add DrawingRenderContext - #2168

Open
IngeborgAtRS wants to merge 3 commits into
oxyplot:developfrom
raysearchlabs:fix-WPF-rendering
Open

IngeborgAtRS wants to merge 3 commits into
oxyplot:developfrom
raysearchlabs:fix-WPF-rendering

Conversation

IngeborgAtRS commented Aug 12, 2026 •
edited
Loading

Copy link
Copy Markdown

Fixes #1794.

Checklist

  • I have included examples or tests
  • I have updated the change log
  • I am listed in the CONTRIBUTORS file
  • I have cleaned up the commit history (use rebase and squash)

Changes proposed in this pull request:

  • Add a new rendering context for WPF that renders the graph to a DrawingGroup instead of creating WPF elements. This improves performance slightly but most importantly, it avoids the nasty behavior of creating new children to the Canvas during the Render phase. When there are a lot of curves this can cause the WPF Measure/Arrange/Render cycle to break and fail to redraw the curves. Make this the default RenderContext for the WPF PlotView.

  • Create a base class WpfRenderContext that holds functionality shared between the different rendering modes. PlotView.RenderContext now returns this type instead of CanvasRenderContext.

  • Tooltips now work in the PlotView if you use the DrawingRenderContext.

  • Create a CanvasPlotView in ExampleBrowser.WPF that uses CanvasRenderContext.

@oxyplot/admins

* Add a new rendering context for WPF that renders the graph to a DrawingGroup instead of creating WPF elements. This improves performance slightly but most importantly, it avoids the nasty behavior of creating new children to the Canvas during the Render phase. When there are a lot of curves this can cause the WPF Measure/Arrange/Render cycle to break and fail to redraw the curves.

* Create a base class WpfRenderContext that holds functionality shared between the different rendering modes. PlotView.RenderContext now returns this type instead of CanvasRenderContext.

* Tooltips now work in the PlotView if you use the DrawingRenderContext.

* Create a CanvasPlotView in ExampleBrowser.WPF that

* Replace Assert.Is* with Assert.That(..., Is.*) in all tests to get rid of legacy NUnit calls

* Fix one of the Issues examples that fails unexpectedly if the current culture does not use dot at decimal separator.

Copy link
Copy Markdown
Author

@VisualMelon, @objorke, is there anyone that can look at this?

objorke commented Sep 11, 2026

Copy link
Copy Markdown
Member

@VisualMelon I understand this is a valuable contribution that could improve the WPF rendering pipeline. But to streamline the manual review process and ensure a clean history, I would recommend the work to be split into several focused pull requests:

  • Test updates: Move all changes to NUnit assertions into a separate pull request with no functional code changes.
  • The core rendering feature: Keep the introduction of DrawingRenderContext, the WpfRenderContext base class, tooltip support, and the default behavior change in the main pull request, and include example and unit tests covering the new rendering context. When accepted, use a squash merge on this PR.
  • Bug fixes: Extract the bug fix into a separate, dedicated bug-fix pull request.

@IngeborgAtRS I suggest to update and create new, segmented pull requests following this structure to get these improvements merged smoothly!

Copy link
Copy Markdown
Author

@objorke I can absolutely split off these:

"Replace Assert.Is* with Assert.That(..., Is.*) in all tests to get rid of legacy NUnit calls

Fix one of the Issues examples that fails unexpectedly if the current culture does not use dot at decimal separator."

However, the fix to issue 1794 is the introduction of the DrawingRenderContext, so it's hard to extract that into a separate PR.

objorke commented Sep 11, 2026

Copy link
Copy Markdown
Member

I see, then I suggest to keep the related bug fix in this PR!

Copy link
Copy Markdown
Author

The test updates have now been reverted (except those in PngAssert.cs, since the .Net 10 version fails to build without them).
The WPF Plot view uses the new DrawingRenderContext by default. In the Example browser, you can choose the old CanvasRenderContext as well.
Since the PR does not introduce any new functionality (it only replaces the renderer, using the same API), I'm not entirely sure what additional unit tests you would expect?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blank Plot on InvalidatePlot (WPF)

2 participants


Back | FazBrowse Home | New Git URL