Click here to Skip to main content
15,906,766 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Not sure if this is even possible...

I would like to make a custom shape (maybe it can be done in blend). The shape is somewhat complex in that it could have curves, straight edges, and holes through out it.

What I want to do with the shape is then display it and have a fill property that is bindable to my view models.

For example I currently use an Ellipse and I have with in it

  <solidcolorbrush color="{Binding Path=ItemColor}" />

I would rather have my custom shape/object that is filled where there are not holes.

Can this be done and if so a little code would help.

This needs to be done in XAML.

I have figured a way to draw the complex shape. Took a while by putting point values in Polygon. What I can't figure out is how to have it resize appropriately.

To further explain the item resides in a DataTemplate and is redrawn over and over. I need the shape to take up the appropriate amount of given space so the "Points" in the polygon must be proportional. Is this possible?

Thank you,
Updated 24-Sep-10 10:10am

1 solution

All these functions exist, have a look at the link below. You need the methods starting with Fill like FillPolygon and FillClosedCurve.[^]

An c# example:[^]

Good luck!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900