Solved my problem.
The solution was to use converters as part of the Grid.Clip
property. I used code from the following site.
http://blogorama.nerdworks.in/entry-CenteringelementsonacanvasinWP.aspx
The challenge I encountered was having to use the EllipseGeometry
instead of just Ellipse
.
Ellipse
uses height
and width
whilst EllipseGeometry
uses radiusx,y
and center
.
With Ellipse
I 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}
<Grid>
<Grid.Clip>
<EllipseGeometry>
<EllipseGeometry.RadiusX>
<MultiBinding
Converter="{StaticResource HalfValue1}">
<Binding
ElementName="vemap"
Path="ActualHeight" />
</MultiBinding>
</EllipseGeometry.RadiusX>
<EllipseGeometry.RadiusY>
<MultiBinding
Converter="{StaticResource HalfValue1}">
<Binding
ElementName="vemap"
Path="ActualHeight" />
</MultiBinding>
</EllipseGeometry.RadiusY>
<EllipseGeometry.Center>
<MultiBinding
Converter="{StaticResource HalfValue}">
<Binding
ElementName="vemap"
Path="ActualHeight" />
<Binding
ElementName="vemap"
Path="ActualWidth" />
</MultiBinding>
</EllipseGeometry.Center>
</EllipseGeometry>
</Grid.Clip>
<Image>
</Grid>