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
Post a Comment