Write Less Code - Theme Detection on Windows Phone 7

I spent alot of time tonight trying to find an elegant solution to the problem of detecting the light or dark theme from Windows Phone 7 and changing images based on those options. I was people that were doing a ToString in the Foreground Brush, or writing custom methods for every image in their code-behind, and all of that felt … dirty. Finally I came across this solution on StackOverflow which is not the “accepted” answer, but is the highest voted answer. It was good enough to get me to post the answer here as well, so I can remember it, and hopefully some of you who might be working to hard can find a more elegant solution.

<Image
    Stretch="Fill"
    Visibility="{StaticResource PhoneLightThemeVisibility}"
    Source="/icons/light.tag.png" />
<Image
    Stretch="Fill"
    Visibility="{StaticResource PhoneDarkThemeVisibility}"
    Source="/icons/dark.tag.png" />