I am trying to clip a 4:3 image with a circle within a grid control.
I need the circle clip to reveal the image from the middle in a perfect circle. See below.
alt text http://www.cse.unsw.edu.au/~vjro855/Untitled.png
The circle should dynamically re-size with the image.
I have tried Canvas.Clip and Ellipse+VisualBrush without achieving the correct behavior.
Thanks!
Solved my problem.
The solution was to use converters as part of the
Grid.Clipproperty. I used code from the following site.http://blogorama.nerdworks.in/entry-CenteringelementsonacanvasinWP.aspx
The challenge I encountered was having to use the
EllipseGeometryinstead of justEllipse.EllipseusesheightandwidthwhilstEllipseGeometryusesradiusx,yandcenter.With
EllipseI could have just set height and width to the height of the image to get the clip i required.Would be a lot simpler if expressions worked with binding ie.
{Binding Path=expr}