wpfframeworkelement

Custom FrameworkElement design


I'm creating a component that looks a bit like a web:

enter image description here

I created a custom FrameworkElement named Web containing a VisualCollection to draw the component. However the design is currently really poor and I want to make it again from ground up.

But I can't figure out how I should design the quarters of this web.

Should they be custom FrameworkElement too? Knowing that I need to handle "click" event on them.

Or should I just make an object extending DrawingVisual per Quarter and make a hittest to know when a quarter has been clicked?

It's my first custom element and I'm a bit lost.

Thank you


Solution

  • You can create a class inherited from Panel. And you can arrange you children elements in a a circular fashion as explained here using Measure and Arrange method. Create another control, which should be clickable. Add those controls as a Children to your custom Panel. Template your container control, so that it can show Arc using ArcSegment.