WPF Ellipse with BackgroundColor and Image

Armando Freire picture Armando Freire · Nov 1, 2012 · Viewed 12.2k times · Source

I'm developing a Windows Phone application and I have some Ellipses. Is it possible to have a background image on them AND a background color?

When I looked for it, VS only allows me to change the Fill property with an image but didn't allow me to keep the Color on Fill + the Image.

Answer

Wonko the Sane picture Wonko the Sane · Nov 1, 2012

Just use two ellipses, overlapping each other:

<Grid>
    <Ellipse Width="100" Height="60" Fill="Navy" />
    <Ellipse Width="100" Height="60">
        <Ellipse.Fill>
            <RadialGradientBrush>
                <GradientStop Color="#00FF0000" Offset="0" />
                <GradientStop Color="#FFFF0000" Offset="1" />
            </RadialGradientBrush>
        </Ellipse.Fill>
    </Ellipse>
</Grid>

Change the fill property of the second to use your image.