Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Exception when including .ico file in WPF

$
0
0

Hi,

I am displaying a tree of missing and existing files in a WPF object. This describes the vertices:

<DataTemplate x:Key="demoTemplate" DataType="{x:Type local:DDNAVertex}"><StackPanel Orientation="Horizontal" Margin="5"><Image x:Name="img" Source="../Images/document.ico" Width="20" Height="20" /><TextBlock Text="{Binding Path=ID, Mode=OneWay}" Foreground="White" /></StackPanel><DataTemplate.Triggers><DataTrigger Binding="{Binding exists}" Value="false">
               LINE 17 <Setter TargetName="img" Property="Source"
                                Value="../Images/missing.ico" /></DataTrigger></DataTemplate.Triggers></DataTemplate>

I took this code example from a tutorial application where it works perfectly. However, I get the following exception:

System.Windows.Markup.XamlParseException: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '17' and line position '29'. ---> System.IO.IOException: Assembly.GetEntryAssembly() returns null. Set the Application.ResourceAssembly property or use the pack://application:,,,/assemblyname;component/ syntax to specify the assembly to load the resource from.

So I assume I am missing something that needs to be set in order for the ico files to be properly used. (It works fine without the use of the ico files). The .ico files are added to my project under the folder /Images. Any help with this is highly appreciated!



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>