Here is is the XAMLcode I am currently using:
<ffimageloadingsvg:SvgCachedImage Source="{DynamicResource GearIcon}" />
GearIcon is set to "Test.Resources.Theme.gear_light.svg" and everything works perfectly. When I set the Dynamic Resource to "Test.Resources.Theme.gear_dark.svg" then the image changes as expected.
Now I am trying to change this to use fluent C# but nothing is working when I do this:
var gear = new SvgCachedImage;
gear.DynamicResource(SourceProperty, SvgImageSource.FromResource(Application.Current.Resources["GearIcon"].ToString()));
I have also tried this:
gear.DynamicResource(SourceProperty, (Application.Current.Resources["GearIcon"].ToString()));
and
gear.DynamicResource(SourceProperty, (ImageSource)(Application.Current.Resources["GearIcon"].ToString()));
Does anyone have any idea how I can set the source dynamically when using C#. Nothing I have tried works so far except the XAML which I am not using right now.