I'am creating a Windows Phone 8.1 app in which I use a number of images that should be shown according to the selected Theme Light or Dark.
The Light and Dark image are created with the correct naming and scaling.
I've created the following ThemeResource to set the Image Source according to the selected Theme.
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<Style x:Key="ShowImage" TargetType="Image">
<Setter Property="Source" Value="Assets/image.png"/>
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<Style x:Key="ShowImage" TargetType="Image">
<Setter Property="Source" value="Assets/image.png"/>
</Style>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
And the XAML to show the Image as necessary.
<Grid>
<Image HorizontalAlignment="Center"
VerticalAlignment="Center"
Stretch="None"
Style="{ThemeResource ShowImage}">
</Image>
</Grid>
When I start the app with a theme selected the correct image is shown every time. However when I select a different theme and then switch back to my app I can see that the background color is updated however my image is not updated dynamically.
As far as I'am aware the ThemeResource should be used to update this dynamically but I can't get it to work. Does anybody know what is wrong with my XAML code?