C# WPF XAML Problem with icon in GridViewColumn
Posted
by Alex
on Stack Overflow
See other posts from Stack Overflow
or by Alex
Published on 2010-03-23T12:59:21Z
Indexed on
2010/03/23
13:03 UTC
Read the original article
Hit count: 454
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!
© Stack Overflow or respective owner