How to change title bar image in WPF Window? -


how change titile bar image (the top-left icon) in wpf?

the icon attribute of window used set icon of window.

<window x:class="windowsample.mainwindow"  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  title="wpf window sample" height="350" width="525"  name="firstwindow" icon="icon1.ico" > 

the icon property of window class represents window's icon @ run-time. property takes imagesource variable.

the following code snippet uses bitmapframe.create method create imagesource , sets icon property of window.

uri iconuri = new uri("pack://application:,,,/icon1.ico", urikind.relativeorabsolute);  this.icon = bitmapframe.create(iconuri); 

you can read more here


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -