Does one Resource item can be used only for one element at the same time?
For instance:
[xaml]
<Window.Resources>
<Image x:Key="DockImage" Source="ico/pin.gif"/>
<Image x:Key="UndockImage" Source="ico/pinHorizontal.gif"/>
</Window.Resources>
and buttons:
<Button Width="26" Name="solutionButton" Click="eventname">
<DynamicResource ResourceKey="DockImage"/>
</Button>
<Button Width="26" Name="soundButton" Click="eventname2">
<DynamicResource ResourceKey="DockImage"/>
</Button>
Their images changes to UndockImage on runtime, but Image is showed only on one of these buttons.
I can multiply Image keys for both DockImage and UndockImage but I assume this will take 2x more memory. Does one resource key can be used for one object (at the same time) ?
Anything deriving from
UIElementcan only be shown at one place at a time. You shouldn’t defineImageresources directly, which is the control used to show images. Instead, use someImageSource-derived class, such asBitmapImage, which represents an image in memory.