In windows form applications, in the form load event I can load filtered excel file data to a listview by using the below code and also setting the properties of the listview GridLines to True & View to Details etc.
ExcelPackage.LicenseContext =LicenseContext.NonCommercial;
int lastRow = 0;
using (ExcelPackage package = new ExcelPackage(new System.IO.FileInfo(filename), false))
{
ExcelWorksheet mainSheet = package.Workbook.Worksheets.First();
for (int i = 2; i = DateTime.Today && DateTime.Parse(mainSheet.Cells[row, 5].Text) 1)
{
listView1.Items.Add(itm);
}
}
}
listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);Now, when I create a listview in WPF using the code in XAML
I don't get the properties like Columns, AutoResizeColumns etc and get errors.
So how do I do this in WPF and also how do I databind the listview with filtered excel data so that when I change the source excel file (say by a button click event) the listview gets automatically updated ?
Thanks!

Jayanta Mukherjee123 reputationPosted Jan 23, 2022, 11:05 AM EST
narayan singhRank #7,785 · 234 reputationPosted Apr 10, 2022, 1:37 PM EDT
Rijwan AnsariRank #82 · 24.2K reputationPosted Jan 23, 2022, 10:55 AM EST