1

Please take a look at my following code:

<Grid>
    <Ellipse StrokeThickness="2" Stroke="White">
        <Ellipse.Fill>
            <ImageBrush ImageSource="someImage.png"/>
        </Ellipse.Fill>
    </Ellipse>
</Grid>

What I'm trying to do is to margin the someImage.png 5px from left and 5px from top. I'm wondering if it's possible as I couldn't find any margin property available.

SuicideSheep
  • 5,260
  • 19
  • 64
  • 117

1 Answers1

2

You could put two Ellipses on top of each other like so:

    <Grid>
        <Ellipse StrokeThickness="2" Stroke="White"/>
        <Ellipse Margin="5" StrokeThickness="2" Stroke="White">
            <Ellipse.Fill>
                <ImageBrush ImageSource="someImage.png"/>
            </Ellipse.Fill>
        </Ellipse>
    </Grid>

The grid will put all the items in the same row/column on top of each other.

Iain
  • 2,500
  • 1
  • 20
  • 24
  • Yea that's 1 way of doing it ... you have to use this above method because there's no inbuilt property which is gonna help your case .. – Vivek Saurav Dec 05 '13 at 05:12
  • @lain: I'm sorry but I just found out something weird. If I'm to just copy and paste your code, there will be 2 circle appear which can be explained because you are moving the whole inner ellipse with margin = 5 – SuicideSheep Dec 05 '13 at 06:33
  • @lain: If I'm to remove the `StrokeThickness="2" Stroke="White"`, then I will see the `imagebrush` overlay on top of the `outer ellise` – SuicideSheep Dec 05 '13 at 06:36