tags:

views:

316

answers:

1

Is it possible to use a JPG file as a Window Icon using strictly XAML? I've found examples where you can use a BitmapFrame within C# to generate an ImageSource on the fly (which is then assignable to the Icon property), but I'd love to do something like:

<Window.Icon>
<SomeXAMLThatLetsMeUseJpg Source="MyJpg.jpg" />
</Window.Icon>

Is this possible?

+2  A: 

You can use a jpg as an icon directly.

Add your icon to the project as a resource, then use it as an icon:

<Window x:Class="WpfApplication1.Window1"
     <!--some more properties are set here...-->
     Icon="myicon.jpg">
</Window>

The jpg is automatically resized.

Kjetil Watnedal