I have a ListView
whose ItemsSource
is bound to a collection.
One of the columns of the ListView
is an image. This image source must be set to a resource file, and the resource is determined by a property of the item.
How Can the converter return the Image source as resource file?
<ListView ItemsSource="{Binding Persons}">
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewTemplateColumn Header="" Width="20" IsReadOnly ="True">
<GridViewTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=Male}" />
</DataTemplate>
</GridViewTemplateColumn.CellTemplate>
</GridViewTemplateColumn>
<GridViewColumn Header="{Binding Resources.Name,
Source={StaticResource resourceHelper}}"
Width="SizeToCells"
DisplayMemberBinding="{Binding Path=Fullname}"/>
<GridViewColumn Header="{Binding Resources.Address,
Source={StaticResource resourceHelper}}"
Width="SizeToCells"
DisplayMemberBinding="{Binding Path=Address}" />
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
So in above case, if it is Male then show icon1 else show icon2.