Logo Subtitle Subtitle

Find unused resources in Silverlight or WPF with ResourceCounter

I am currently working on a very interesting Silverlight Project for Philips Healthcare. Like all projects it is rapidly growing and it’s time for some cleaning up.

When you use Expression blend it’s easy to create static resources for everything you are going to re-use. Static resources are always loaded in Silverlight. Even if they are not used. Unfortunately Expression Blend does not have a way to get rid of unused resources. Last year I built a small WPF app that analyses your project for you and indicates unused static resources. I’ve used it again today and decided to share it with you.

ResourceCounter

Download and extract ResourceCounter.zip and run the exe.
Enter a valid path to a Silverlight or WPF project and click ‘Analyse’

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 I’ll show you how.

Buttons with vector images

Start Expression Blend and place a button on the Grid.


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. Rightclick the button in the Objects and Timeline tab and choose: Edit Additional Templates | Edit generated Content | Create Empty…

Choose a name and hit OK

A DataTemplate resource has been created in the UserControl.Resources collection. Draw an ellipse and a rectangle to create the search icon (or be more creative :-)

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.

Mac OS Lion keystrokes for me myself and I

This blogpost is just a reminder to myself to use the following keystrokes. What are you still doing here? ;-)

Action Keystroke
Shutdown without questions ctrl+alt+cmd+eject
Sleep without questions alt+cmd+eject
Quit frontmost application hold shift+alt+cmd+esc
Screenshot of selected area shift+alt+4
Insert Euro symbol shift+alt+2

Always open the finder in column view

I’m new to the finder and like the column view. When I installed OSX Lion, the finder always opens in Icon view.

To always open the Finder in Column view

  • Open the Finder
  • Press Command-J

  • Check the “Always open in column view”
  • Repeat this for all your drives and/or partitions