Erwin Alva
Erwin Alva

Reputation: 393

Canvas Control Editing

I need to create a control that would allow a user to manipulate (reposition, rotate) shapes (widgets?) inside a canvas control. The shapes can vary: triangle, square, even geometric paths and could potentially have thousands of them inside the canvas.

The shapes' attributes are bound to strongly-typed classes that indicate positioning, angle of rotation, etc.

My current thought is:

  1. Each widget shape is its own control (the behavior varies for each shape), though a template can be applied to vary the presentation. This would also allow me to vary manipulation logic depending on the valid operations on the shape.
  2. The controls are assigned to a canvas control (which itself has an image for a background) that would allow absolute positioning.
  3. I'm assuming the parent of the control will always be a canvas (for bounds checking).

Am I on the right track or way off? Are there similar samples out there (I tried looking, but maybe not enough).

enter image description here

Upvotes: 0

Views: 109

Answers (1)

Filip Skakun
Filip Skakun

Reputation: 31724

If there's any chance to have item count ranging in thousands - I'd recommend using DirectX or Direct2D. You can still use C# if you use SharpDX or Win2D but XAML doesn't have the performance to move so many elements around.

Upvotes: 2

Related Questions