I'm coding simple file explorer in WPF and I have Listview with 5 columns (Name, Extension, Size, Date, Attributes)
XAML looks this:
<ListView Name="ListView" BorderThickness="2,0,2,0" BorderBrush="Gray" Height="Auto" Width="Auto" >
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="450"/>
<GridViewColumn Header="Extension" DisplayMemberBinding="{Binding Extension}" Width="70"/>
<GridViewColumn Header="Size" DisplayMemberBinding="{Binding Size}" Width="80"/>
<GridViewColumn Header="Date" DisplayMemberBinding="{Binding Date}" Width="80"/>
<GridViewColumn Header="Attributes" DisplayMemberBinding="{Binding Attributes}" Width="60"/>
</GridView>
</ListView.View>
Then, I have class FileInfo with five properties, each binded to column via DisplayMemberBinding
public class FileInfo
{
public string Name { get; set; }
public string Extension { get; set; }
public string Size { get; set; }
public string Date { get; set; }
public string Attributes { get; set; }
}
var files = new List<FileInfo> { new FileInfo { Name = "Foo", Extension = ".sub", Date = "1.1.2015", Size = "3.05", Attributes = "H" } } //just as test
ListView.ItemsSource = files;
That works fine.
Now, in column Name I want to combine file name with its associated icon. And I don't know, how to do that. I don't want to create another column for icon, icon must be included in Name column.
Any ideas? Is there a way to do this programmatically, or do I need to modify XAML?