I’m building a WPF app in Blend 3 which has an “indicator light” that I want to switch to an ON state when a game controller is detected. I am using a canvas object with the background set to an image brush resource defined in a resource dictionary.
<Canvas x:Name="ControllerIndicator" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="13" Height="13" Background="{DynamicResource Light_off}" Margin="0,0,303,35"/>
When my app detects the presence of a controller I want to programatically set the background of the canvas to another image brush resource I have defined in my resource dictionary; something like this:
(C#)
ControllerIndicator.Background = (ResourceDictionary.name???).Light_on;
Can I do it this way? If so, does anyone know the syntax?
Or, do I need to create the brush(s) dynamically in C#?
Any suggestions much appreciated.