Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Ellipse with BackgroundColor and Image

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.

like image 389
Armando Freire Avatar asked Nov 01 '12 12:11

Armando Freire


1 Answers

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.

like image 103
Wonko the Sane Avatar answered Sep 20 '22 22:09

Wonko the Sane