Header add


In this tutorial we discussed how to use [Font-awesome]  icon in WPF. The [Font-awesome] is mostly used on Web application. We will see how to use it WPF.

You can go through the link [Font-awesome]


Let's Check how to use [Font-awesome]  icon in WPF.
Step-1: Open VS 2017 >> File New Project >> Choose WPF Project

Step-2: Go to Tools >> Package Manager Console

    Install-Package FontAwesome.WPF
Step-3: Add the resource file in "App.xaml"
     <Application.Resources>
            <FontFamily x:Key="FontAwesome">/Fonts/fontawesome-webfont.ttf#FontAwesome</FontFamily>
        </Application.Resources>
Step-4: Open the "MainWindow.xaml" and add the [Font-awesome]  icon
    <!--register the icon-->
    xmlns:fa="clr-namespace:FontAwesome.WPF;assembly=
        FontAwesome.WPF"
    
            <StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" Orientation="Horizontal" Margin="0 50 0 0">
                <fa:ImageAwesome Icon="Github" VerticalAlignment="Center" HorizontalAlignment="Center" 
                            Width="80" Height="80" Name="Github"></fa:ImageAwesome>
                
                <fa:ImageAwesome Icon="PieChart" VerticalAlignment="Center" HorizontalAlignment="Center" 
                            Width="80" Height="80"></fa:ImageAwesome>
                <fa:ImageAwesome Icon="Google" VerticalAlignment="Center" HorizontalAlignment="Center" 
                            Width="80" Height="80"></fa:ImageAwesome>
                <fa:ImageAwesome Icon="Code" VerticalAlignment="Center" HorizontalAlignment="Center" 
                            Width="80" Height="80"></fa:ImageAwesome>
            </StackPanel>
    <!--Add the spinner icon-->
            <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
                <fa:ImageAwesome Icon="Spinner" Spin="True" SpinDuration="10" Rotation="40" Width="50" Height="50"  />
                <fa:ImageAwesome Icon="Instagram" Spin="True" SpinDuration="10" Rotation="40" Width="50" Height="50" Foreground="Violet"  />
                <fa:ImageAwesome Icon="Twitter" Spin="True" SpinDuration="50" Rotation="10" Width="50" Height="50" Foreground="DeepSkyBlue"  />
            </StackPanel>
Step-5: This is all set the changes and run the application. As you see we implement the  [Font-awesome]  icon in WPF.


</> The Source Code is available in Github.com/CoreProgramm/




   Summary
    In this tutorial we discussed how to use [Font-awesome]  icon in WPF. If have any question related to this topic then give your feedback.

Post a Comment

Previous Post Next Post