Search code examples
c#wpfxaml

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?


Solution

  • 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>