I try to insert an Image to my GUI application by means of a Binding and a Converter. I create an instance of a value converter in the resources of my MainWindow:
"xmlns:my1="clr-namespace:MyApp"
<Window.Resources>
<ResourceDictionary x:Key="Resc">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="StylesDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<my1:DirectionToImageConverter x:Key="DirectionToImageConverter"/>
</Window.Resources>
However, when I try to run the application I get the following exception:
''Resources' property has already been set on 'MainWindow'.' Line number '16' and
line position '11'.
Please help. Thanks a lot in advance.
You need to put your converter in the resource dictonary, see this question.
<Window.Resources>
<ResourceDictionary x:Key="Resc">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="StylesDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
<my1:DirectionToImageConverter x:Key="DirectionToImageConverter"/>
</ResourceDictionary>
</Window.Resources>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With