In our applications we have several large ResourceDictionaries that contain many images that we then use throughout our applications.
For example, we have a "refresh" icon defined as :
<BitmapImage x:Key="Refresh32Image" UriSource="Refresh32px.png"/>
Then whenever we want to show that image on any WPF window we just put this:
<Button x:Name="RefreshButton">
<Image Source="{StaticResource Refresh32Image}"/>
</Button>
We have this in dozens of different windows etc.
We are now switching over to use Telerik Implicit Theming and we can make this work by adding an IconSource at the top of each window and changing the buttons content to :
<Image Style="{StaticResource Image16Style}"
Source="{telerik:IconResource IconRelativePath=Refresh32px.png,IconSources={StaticResource CommonIconSources}}"/>
This does work, however, requires a LOT of code changes throughout the application. We have hundreds of buttons that would all need updating with various different image filenames etc. etc.
So ideally we want to change the Bitmap Image Resource instead, so that we don't have to change the button content, and of course, any new buttons that we want to add are much simpler.
However, we cannot find way to do this. We have tried this, so instead of declaring the Refresh32Image as a BitmapResource, instead it's an IconResource
<telerik:IconResource x:Key="Refresh32Image" IconRelativePath="Refresh32px.png" IconSources="{StaticResource CommonIconSources}" />
However, this won't compile because when we then try to use that resource in a button, WPF shows:
'Telerik.Windows.Controls.IconResourceExtension' is not a valid value for property
We also tried declaring the image resource as
<BitmapImage x:Key="Refresh32Image" UriSource="{telerik:IconResource IconRelativePath=Refresh32px.png,IconSources={StaticResource CommonIconSources}}"/>
But this is rejected as
Property 'UriSource' or property 'StreamSource' must be set.
I'm sure there must be an easy way of declaring BitmapImage resources just once and reusing them wherever we need using IconResources, so can you help us work out how to do this?