Using a XAML vector image as a window icon

LearnWPF.com posted this article about converting bitmap images to XAML and using them in your applications.

The outer element of the XAML image is a Canvas. However, the Window.Icon property only accepts an ImageSource object. Does anyone know how I can 'wrap' the Canvas in an ImageSource so I can use it as a window icon?

Alternatively, is there a better way to use a XAML image as a window icon?

Answers


The WPF window Chrome(header bar, Icon etc) are part of the typical Win32 Window system. So it was not built to use with Vector Icon, you need to specify an .Ico, .png or some other supported image file to the Window.Icon property.

But if you really want to make a Vector(XAML) animating Icon, you need to think about the concept of Chrome less window. That means gets rid of the old style window chrome(WIndowStyle="None") and build our own chrome entirely with WPF, then you can place your Vector directly over the left top corner and it will just work as you do with any other XAML Visuals in the application.

Read more about how to create Chromeless window on bellow links


Need Your Help

Oracle Script File Execution in *.bat file not completing

oracle batch-file windows-xp oracle9i

I have the following *.bat file executing itself on a schedule. This file consists of different tasks, primarily involves in having a the backup dump file exported to the Test DB Machine every day.

Trying to create fields based on a case statement

sql sql-server sql-server-2008 join aggregate-functions

I'm having some trouble with the query below. I am trying to determine if the "category" field is A, B or C and then creating a field based on the category. That field would sum up payments field. ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.