Skip to content

WpfPlot: UserControl → CustomControl #2509

@KroMignon

Description

@KroMignon

Feature Suggestion

At this time, WPF version of ScottPlot uses UserControl.
This introduce some limitations:

  1. Appearance of an UserControl cannot be changed using a Template. Even though it has a property for Template, but it is of no use, as you cannot change the appearance of UserControl through this property.

  2. UserControl is derived from ContentControl, thus if you change the content of an Usercontrol the entire UI will be replaced with that content.

  3. As UserControl has both XAML and code behind. But as XAML can be used only once for entire inheritance hierarchy, you cannot use XAML for any class that inherits from your UserControl. This is actually because Application.LoadComponent loads up the XAML once and is incompatible with inheritance. Thus when loading the XAML, the IComponentConnector interface is used to hook events and fields from XAML, hence you cannot replace XAML from your base class.

I would like to change this to use CustomControl, this would remove those limitation.

Feature description:

As the ScottPlot WPF control is quiet simple this is not a big deal to achieve, I have already did it locally because I need it for my application.

This way, I can specialize the "base" control for example to add support for Crossbar, and not have to copy/past the crossbar code on each view on which I use it (I am a lazy developer ;-) )

I have also changed the events to use RoutedEvent instead of event, to be able to use them on XAML side.

If there is any interest about this, I could submit my changes as PR (need to learn how to do it, it would be my first PR!)

Best regards

Fabrice

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions