What are the challenges you face when working across database platforms? Take the survey

References to image files passed as a property from c# code to XAML does not work after obfuscating

In XAML we have for example:
<Image Style="{StaticResource GrayableImage}" DockPanel.Dock="Left" Stretch="Uniform" Height="64"
                                            Source="{Binding Path=.ImagePath}"
                                           IsEnabled="{Binding Path=.Available}"/>

ImagePath is declared as a string and is assigned a value like "/HotDiskResources;component/Images/AnImage.png"

HotDiskResources is a class library embedded in the exe-file after obfuscation. /Images is a subfolder only containing image files.
We use SmartAssambly

I have tried with different obfuscation settings but have not managed to solve this. This does work when not obfuscated.

Extra information:
Hard coded image paths in XAML do work after obfuscation. For example
<Image Height="20" Stretch="Uniform"
                           Source="/HotDiskResources;component/Images/OtherImage.png" />

When I print out the value of ImagePath in a log file it si not obfuscated and look as expected.

Regards @nders


Sign In or Register to comment.