Icons or other visuals with XAML instead of bitmaps

You want to use vector images in your Silverlight project instead of bitmaps? In this tutorial you'll learn how to do that


When u use a .PNG icon, you can drag this on the button. But we are going to draw a little magnifying glass icon with Expression Blend.



A DataTemplate resource has been created in the UserControl.Resources collection.


And that’s it! Apply this datatemplate to the ContentTemplate of other buttons to re-use the vector drawing:


This resource was created in the UserControl MainPage.xaml. It’s a better idea to create the resource in a separate resource file like Visuals.xaml but that depends on your preferences.

Written by Loek van den Ouweland on August 24, 2011. Questions regarding this artice? You can send them to the address below.
By using this site, you acknowledge that you have read and understand our Cookie and Privacy Policy.