I am trying to make a WPF program that will go through a list of items and put each of those listed items into a list view.
However when I add the items to the list view the columns just show up empty (but highlight when I mouse over the list view so the items are being added)
I was just wondering why the values are not showing up in the columns. Also if it helps I know that "SetData" has values in it because I did a step-into and watched the values be added.
XAML
<ScrollViewer Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="4">
<ListView x:Name="LIV_SetList">
<ListView.View>
<GridView>
<!--Each column will display a specific property of the set, its name, code and total number of cards-->
<GridViewColumn Header="Set Name" DisplayMemberBinding="{Binding SetName}"/>
<GridViewColumn Header="Set Code" DisplayMemberBinding="{Binding SetCode}"/>
<GridViewColumn Header="Number Of Cards" DisplayMemberBinding="{Binding SetCount}"/>
</GridView>
</ListView.View>
</ListView>
</ScrollViewer>
.cs
// Shove all the data just gathered into a Set Overview, and put that set overview into a list item which is then added to the listview
Classes.SetOverview SetData = new Classes.SetOverview { SetName = SetReader["name"].ToString(), SetCode = TempCode, SetCount = SetSize };
LIV_SetList.Items.Add(SetData);
SetOverview Class
public class SetOverview
{
//This Is Used On The Main Window To Display Information Regarding A Given Sets Name Code And Number Of Cards
public string SetName;
public string SetCode;
public int SetCount;
}
It's hard to say for sure without know how you define the SetOverview class but if it's just a class with 3 string members (SetName, SetCode, SetCount) make sure they are defined as public properties (with get and set) not just regular strings. for example:
public class SetOverview
{
public string SetName { get; set; }
public string SetCode { get; set; }
public string SetCount { get; set; }
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.