2
I have the next Resourcedictionary:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:semaforo.imagens">
<BitmapImage x:Key="semaforoVerde" UriSource="green.png" />
<BitmapImage x:Key="semaforoAmarelo" UriSource="yellow.png" />
<BitmapImage x:Key="semaforoVermelho" UriSource="red.png" />
Whenever I want to change the color of the traffic light I do so:
semaforo.Source = new BitmapImage(new Uri("pack://application:,,,/imagens/red.png"));
Instead of the Uri used above it is possible to use something simpler like x:Key="semaforoVerde" or something like that?
Do you want to do this in the code or in the shaman?
– ramaral
In the code. I’m still using the syntax of ""pack://application:,,,/images/red.png" without being sure what it is!
– gtpt