Skip to content

ScottPlot5: WpfPlot as CustomControl#2565

Merged
swharden merged 4 commits intoScottPlot:mainfrom
KroMignon:CustomControlV5
Apr 6, 2023
Merged

ScottPlot5: WpfPlot as CustomControl#2565
swharden merged 4 commits intoScottPlot:mainfrom
KroMignon:CustomControlV5

Conversation

@KroMignon
Copy link
Contributor

@KroMignon KroMignon commented Apr 5, 2023

Purpose:

Use Control as base class for WpfPlot instead of UserControl to enable customization. (cf #2509).

Changes:

  • update ScottPlot5-wpf Solution Filter to add missed ScottPlot.OpenGL project
  • WpfPlot use now a template and is based on System.Windows.Controls.Control, very close to ScottPlot4 version (Convert WpfPlot to CustomControl #2526).

I am not totally happy with this control. The method WpfPlot::Replace() has a bad taste to me. It looks weird as the control hold by the new Interaction instance my be another one as the control to which it will be set.

This looks very error prone to me 💣

- update ScottPlot5-wpf.slnf to add missed ScottPlot.OpenGL project
- WpfPlot use now a template and is based on System.Windows.Controls.Control
@swharden
Copy link
Member

swharden commented Apr 6, 2023

@KroMignon this is fantastic, thanks so much! I'll make a few small changes to improve mirroring between the WPF and WinForms controls and merge this into main in a few minutes 🚀

@swharden swharden enabled auto-merge April 6, 2023 00:55
@swharden
Copy link
Member

swharden commented Apr 6, 2023

The method WpfPlot.Replace() has a bad taste to me

I agree! This strategy was originally created so users could customize the interactivity (swapping what mouse buttons do, changing zoom and pan behavior, etc) but I think the API can benefit from improvement in the future

@swharden swharden merged commit fd62a1c into ScottPlot:main Apr 6, 2023
@KroMignon KroMignon deleted the CustomControlV5 branch July 10, 2023 08:14
@swharden swharden mentioned this pull request Jan 21, 2024
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.

2 participants