WPF中listview控件绑定了数据但是运行的时候数据不显示是为什么?怎么解决呢??

无悔青春_j进无止境 无悔青春_j进无止境 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

private void Button_Click_2(object sender, RoutedEventArgs e)
{

ObservableCollection<PersonalInfo> personalInfoList = new ObservableCollection<PersonalInfo>();//声明一个动态数据集合类的对象
//给数据集合添加类成员
personalInfoList.Add(new PersonalInfo("雀巢咖啡",5,10,"无"));
personalInfoList.Add(new PersonalInfo("脉动",20,5,"无"));
personalInfoList.Add(new PersonalInfo("三只松鼠",10,10,"无"));
personalInfoList.Add(new PersonalInfo("康师傅方便面",15,4.5,"无"));
personalInfoList.Add(new PersonalInfo("薯片",50,8,"无"));
listView.ItemsSource = personalInfoList;//将数据和UI绑定在一起

}

这是其中一段代码,我想把这些数据显示在列表里,但运行的时候是这样的
...全文
评论 11
收藏 已收藏
分享
返回顶部
无悔青春_j进无止境
C# 111,130 成员 642,541 内容