1

I am facing a problem that have kind of already been asked here before, as far as I have seen. I read most of these but didn't find the right answer.

This is what I need:

  • Complex shaped zone (i.e: countries, states..)
  • Having possibility to get events on it (especially mouse's)
  • Possibility to place some conrols in it (i.e: images, buttons)

I saw that some uses usercontrols, controltemplates.. But how should I do for that kind of shape ? Most of questions was for some basic mix of standard shapes.
(I saw with Blend that we can make path object with a pen, is there a way to use this to define the shape of a zone ?)

Thanks.

LeLolDuLol
  • 31
  • 6
  • "didn't find the right answer" is not an excuse to create a duplicate, is this *any* different than those? – H.B. Apr 27 '12 at 17:30
  • @H.B. Actually, I think that this is different. In the way that the shape I need can't be a standard Polygon, and thus I thought that the way to do had to be different. (This is also why I talk about the pen tool.) – LeLolDuLol Apr 30 '12 at 22:19

2 Answers2

0

Create your own control and have its main container be a Canvas. Have the canvas background be transparent and then you can place all the controls you want on it. You can use a Polygon as your main shape inside the Canvas and place all the controls you want on the Canvas (but I guess for your purpose, you would want to make sure to not place them outside of the area covered by the polygon.

Let each object you use handle the mousedown event then you can individually drag them. When mousedown occurs, use the CaptureMouse() method on the object you clicked so that all dragging (on or off of the main window) will still be captured by the object you clicked. Make sure to call ReleaseMouse() in the mouseup event.

You can create as many instances of your control as you need. All with different shapes defined by the polygon each one contains. You can slap all of these objects on a single grid or canvas, and you're good to go.

Curtis
  • 5,794
  • 8
  • 50
  • 77
0

You can use the PathPanel class that is provided in the Expression Blend SDK. More information here

Kobi Hari
  • 1,259
  • 1
  • 10
  • 25