How to add Icon and Content to the button in XAML

JeffinAtl 161 Reputation points
2021-06-03T14:46:59.157+00:00

I'd like to add a icon and text to the button like attached image.
I made XAML code like following but doesn't work.
(I will use FontAwesome for the icon)

<StackPanel Grid.Row="1" Grid.Column="5" Orientation="Horizontal">  
        <Button Style="{StaticResource IconButton}" VerticalAlignment="Center">  
                <Button.Content>  
                      <fa:FontAwesome Icon="Search" Width="110" Height="50" FontSize="18" Foreground="#001c38"/>  
                </Button.Content>  
        </Button>  
</StackPanel>  

102039-button.png

How to do this?

Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2021-06-03T15:42:42.217+00:00

    I created a code sample that shows how to add an image to a button.

    102129-figure2.png

    Edit Realized I didn't do the text, revised code does text and image.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.