I have a data model that represents segments of a curve that looks like this:
Envelope Curve http://img710.imageshack.us/img710/9059/envelope.png
The fields are the x and y coordinates of the control points (red) and the slope value represented by the control points (green). To make the curve editable by the user, Iām thinking about using Thumb objects for anchor and control points.
Since I would also like to introduce the user to the interface into which you can enter the coordinates in the text fields, Iām thinking about implementing this curve editor as a useless control. The problem I am facing is finding the best way to organize the elements. Some thoughts on what I could do:
- Add data model view objects to the ItemsContainer with a custom ItemsPanel and DataTemplate that creates one reference point and one control point for each data model object. This forces two and two points to be wrapped in ContentPresenter, which makes it difficult to interact between the user panel and the thumb.
- Use two different data model view objects: one for control points and one for control points, and DataTemplateSelector to select the correct DataTemplate. As long as there is ContentPresenter content between the element and the panel (can this be avoided?), Interaction can be easier when there is only one element in ContentPresenter.
- Do not use the ItemsContainer at all; instead, add Thumb objects directly to the visual and logical trees of the custom panel. Of course, I lose a lot of flexibility when it comes to the appearance of Thumb objects when they are not specified by templates. It may be possible to duplicate this function from the ItemsContainer, so my control may have separate DataTemplates for control and control points. Thumb objects can then be added directly to the panel without ContentPresenters.
What is the most sensible way to do this? Are there other alternatives than the ones I was thinking about?
source share