MartinTopfstedt / FontAwesome5

WPF controls for the iconic SVG, font, and CSS toolkit Font Awesome 5.
MIT License
120 stars 23 forks source link

Can't render multiple instances of one icon in the same context using a single Style? #17

Closed jasonxz closed 4 years ago

jasonxz commented 4 years ago

Here's the Style: ` `

`

MartinTopfstedt commented 4 years ago

Hi,

inside your Style you set "Content" but you need to Set "ContentTemplate": https://stackoverflow.com/questions/7250709/set-a-buttons-content-in-style

 <Style x:Key="CopyButton" TargetType="{x:Type Button}">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <fa5:FontAwesome FontSize="10" Foreground="Black" Icon="Solid_Copy" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Top" />
        </Style>
jasonxz commented 4 years ago

Sigh....I knew that....smh…..