如何显示的时间记录在WPF ListView中的内容?
问题描述:
我一直在寻找答案,但我还没有找到一个真正的。
我知道这个逻辑,但我没有这个想法如何实现它。
I've been searching for answers but I haven't found one really. I know the logic but I just don't have the idea how to implement it.
这是我的时间日志:
No Mchn EnNo Name Mode IOMd DateTime
00001 1 00001234 1 0 2004/01/01 01:01
00002 1 00001234 1 0 2015/05/12 04:01
00003 1 00001234 2 0 2015/05/12 04:01
00004 1 00001234 1 0 2004/01/01 01:01
00005 1 00001234 1 0 2015/05/13 10:42
和我想这个转换成一个列表视图。
真的需要你的帮助。
and I want to convert this into a listview. Really need your help.
答
下面是我的回答是:
namespace textfile
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void LoadButton(object sender, RoutedEventArgs e)
{
foreach (string line in File.ReadAllLines(@"GLG_001.TXT"))
{
var listViewItem = new ListViewItem();
listViewItem.Content = line;
ListView.Items.Add(listViewItem);
}
}
}
}