WPF is still one of the most used app frameworks in use on Windows (right behind WinForms).
It was in 2006 that Windows Presentation Foundation (WPF) was released with . NET framework 3.0. Over the years it got improved and it is still now in the market in 2021.
Assuming you use VS Express and C#. The icon is set in the project properties page. To open it right click on the project name in the solution explorer. in the page that opens, there is an Application tab, in this tab you can set the icon.
@742's answer works pretty well, but as outlined in the comments when running from the VS debugger the generic icon is still shown.
If you want to have your icon even when you're pressing F5, you can add in the Main Window:
<Window x:Class="myClass"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Icon="./Resources/Icon/myIcon.png">
where you indicate the path to your icon (the icon can be *.png
, *.ico
.)
(Note you will still need to set the Application Icon or it'll still be the default in Explorer).
Note: (replace file.ico with your actual icon filename)
Icon=".\file.ico"
on the WindowAfter getting a XamlParseException with message: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' with the given solutions, setting the icon programmatically worked for me. This is how I did it:
Icon = new BitmapImage(new Uri("<icon_path>", UriKind.Relative));
Please inform me if you have any difficulties implementing this solution so I can help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With