Armando Freire
Armando Freire

Reputation: 417

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.

Upvotes: 7

Views: 16357

Answers (2)

Anonymous
Anonymous

Reputation: 61

try this:

<Ellipse>
  <Ellipse.Fill>
    <ImageBrush ImageSource="/myimage.png" Stretch="Fill"></ImageBrush>
  </Ellipse.Fill>
</Ellipse>

Upvotes: 5

Wonko the Sane
Wonko the Sane

Reputation: 10813

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.

Upvotes: 10

Related Questions