How to change the color of the icon inside a Rectangle - WPF

Asked

Viewed 74 times

1

I need to change the color of my button icon to "White Color", but I don’t know how to do it. I’m using a Mahapss icon pack... I’ve seen it on the net using GRID’s Contentcontrol, but being inside a Rectangle, I have no idea... Someone knows how to do this?

inserir a descrição da imagem aqui

<Button Width="148" Height="48" Margin="0 0 10 0" Style="{StaticResource susButton}">
    <Button.Content>
        <StackPanel Orientation="Horizontal">


            <Rectangle Width="20" Height="20" Margin="0 0 7 0">
                <Rectangle.Fill>
                    <VisualBrush Visual="{StaticResource appbar_add}" Stretch="None" />
                </Rectangle.Fill>

            </Rectangle>

            <TextBlock Text="Novo Cadastro">

            </TextBlock>
        </StackPanel>
    </Button.Content>
</Button>

1 answer

1


According to the library’s reference, this would be the solution:

<Rectangle Width="20" Height="20" Margin="0 0 7 0" Fill="White">
    <Rectangle.OpacityMask>
        <VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
    </Rectangle.OpacityMask>
</Rectangle>

Source

  • Thanks Leandro Angelo. It worked well! :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.