In xaml it is :
<View:BaseWindow.Icon>
/VBDAdvertisement;component/Images/logoVBD.png
</View:BaseWindow.Icon>
I want to convert it into code behind.
Thanks
In xaml it is :
<View:BaseWindow.Icon>
/VBDAdvertisement;component/Images/logoVBD.png
</View:BaseWindow.Icon>
I want to convert it into code behind.
Thanks
Try this its absolutely working for both png as well as ico image format.
Something like
You may need to qualify the path more though.
Edit: As i thought the path should be in pack-uri format:
This is the correct way to do it (assuming MyIcon.ico is placed on the root folder of a WPF project named MyApplication):
This is also what actually happens when you set the Icon property for the window in XAML.
When just setting the Icon to a new Bitmap, it will not be rendered smoothly and correctly, but instead quite a bit pixelated.