Reputation: 33589
This answer shows how to make ListView display and icon and some text alongside it:
WPF - Create a listview with icons
But the icon is not in its own column. I want an icon column and a text column. How to do that?
Upvotes: 1
Views: 2287
Reputation: 33364
You did not show how your ListView
looks like so I'll assume it's very similar to that other question. You need to set ListView.View
and specify columns. One, with your template, for image and another for text:
<ListView ItemsSource="{Binding Items}">
<ListView.Resources>
<DataTemplate x:Key="Template">
<Image Source="{Binding Path=Icon, Converter={StaticResource Conv}}" Width="64" Height="64"/>
</DataTemplate>
</ListView.Resources>
<ListView.View>
<GridView>
<GridViewColumn Header="Icon" CellTemplate="{StaticResource Template}"/>
<GridViewColumn Header="Text" DisplayMemberBinding="{Binding Name}"/>
</GridView>
</ListView.View>
</ListView>
Upvotes: 2