Why does it not work?
I also did these variant ./icon/icon.png
, pack://application:,,,/icon/icon.png
, pack://MyProject:,,,/icon/icon.png
or fetched the icon from the directory and tried these variant /icon.png
, pack://application:,,,/icon.png
, pack://MyProject:,,,/icon.png
but that doesn`t work either.
I got this error message: IOException: Cannot locate resource 'icon/icon.png'.
How should I write the path?
<Window x:Class="MyProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MyProject"
mc:Ignorable="d"
Title="MyProject" Height="450" Width="800" Icon="icon/icon.png">
<Canvas>
</Canvas>
</Window>