I am creating a WPF application with a list in which I bind to project names. As a decorative item, I want to place a small icon next to each item in the list, similar to how Outlook makes it in the list of personal folders. For starters, I'm going to use the same image for all the items in the list.
Here is the markup I got so far (I will translate it into the resource dictionary after its work):
<ListBox.Resources>
<ImageBrush x:Key="ProjectIcon" ImageSource="Images/project.png" />
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{StaticResource ProjectIcon}"/>
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
I have an error in the image resource, but I do not know how to fix it. Any suggestions? Thanks.
source
share