开发者

Ellipse default Fill color

开发者 https://www.devze.com 2023-01-07 23:01 出处:网络
I use an ImageBrush to fill an Ellipse. <ImageBrush Stretch=\"Uniform\" ImageSource=\"{Binding Image}\" />

I use an ImageBrush to fill an Ellipse.

<ImageBrush Stretch="Uniform" ImageSource="{Binding Image}" />

Since I use uniform stretching my image doesn't fill the whole area of the ellipse and th开发者_如何学JAVAe empty space is transparent. I couldn't find a way to fill it with some other color. Any ideas how to achieve that?


I can't think of a nice way to do this. You could simply draw an Ellipse underneath using a SolidColorBrush and have an Ellipse using an ImageBrush on top of it, something like:

<Grid>
  <Ellipse Fill="Red" />
  <Ellipse>
    <Ellipse.Fill>
      <ImageBrush Stretch="Uniform" ImageSource="{Binding Image}" />
    </Ellipse.Fill>
  </Ellipse>
</Grid>

...but that's pretty nasty. Is there a reason why a Stretch property value of UniformToFill won't work? Do you definately need to see the entire image at all times?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号