简体   繁体   中英

Put icon to a XAML ellipse

I am new to XAML. I encountered this problem that I need to place a symbol icon or font icon into an Ellipse shape (so it shows like an icon inside a circle). However, seems like the Ellipse's Fill property only takes ImageBrush and ColorBursh . ( MSDN )

How can I add an icon to the Ellipse?

try this (replace your own font symbol in TextBlock Text)

<Grid>
    <Ellipse Stroke="Red"
             Fill="Red"
             StrokeThickness="5">
    </Ellipse>
    <TextBlock Text="&#xf001;"
               VerticalAlignment="Center"
               HorizontalAlignment="Center">

    </TextBlock>
</Grid>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM