I'm trying to populate a ListView with properties from a class that I have stored in a BindinglList, but it is only showing the object name. I'm unfamiliar with how to get the correct properties to bind to the correct headers. below is the code and screenshot of the wall im facing.
This is my code:
public abstract class Part
{
public int PartID { get; set; }
public string Name { get; set; }
public double Price { get; set; }
public int Inventory { get; set; }
public int Min { get; set; }
public int Max { get; set; }
}
public class Outsourced : Part
{
private string CompanyName { get; set; }
public Outsourced(string name, int inventory, double price, int max, int min, string companyName)
{
Name = name;
Inventory = inventory;
Price = price;
Max = max;
Min = min;
CompanyName = companyName;
}
public string GetCompanyName()
{
return CompanyName;
}
}
public MainWindow()
{
InitializeComponent();
Outsourced part = new Outsourced("tire", 1, 3.00, 1, 1, "ddddd");
Inventory.addPart(part);
partsListview.ItemsSource = Inventory.PartsInventoryList;
}
This is my XAML:
<ListView Margin="5" Name="partsListview" Height="250" >
<ListView.View>
<GridView >
<GridViewColumn Header="Part ID" Width="90"></GridViewColumn>
<GridViewColumn Header="Name" Width="90" ></GridViewColumn>
<GridViewColumn Header="Inventory" Width="90"></GridViewColumn>
<GridViewColumn Header="Price" Width="90"></GridViewColumn>
<GridViewColumn Header="Min" Width="90"></GridViewColumn>
<GridViewColumn Header="Max" Width="70"></GridViewColumn>
</GridView>
</ListView.View>
</ListView>
