C# WPF XAML Problem with icon in GridViewColumn
- by Alex
I've created a ListView with a GridView component in it. Now trying to fill one of the cells with an icon (PNG) like in the code sample below (save_icon.png):
<ListView.View>
<GridView>
<GridViewColumn Header="Date" Width="Auto" DisplayMemberBinding="{Binding Date}" />
<GridViewColumn Header="Time" Width="Auto" DisplayMemberBinding="{Binding Time}" />
<GridViewColumn Header="FriendlyName" Width="Auto" DisplayMemberBinding="{Binding FriendlyName}" />
<GridViewColumn Width="Auto">
<Image Source="save_icon.png" />
</GridViewColumn>
</GridView>
</ListView.View>
Visual Studio gives me an error on the line, where i put the icon into the column (ERROR: "Error 35: The file save_icon.png is not part of the project or its 'Build Action' property is not set to 'Resource'.") I added the icon to the project as a resource and when i start the app, everything works (the icon appears at the right place). But the WPF designer window can't be reloaded and i'm not able to see changes in the designer, when i change the XAML code.
Can somebody explain this error or am i doing something wrong?
Thanks for every hint in advance!