展开全部
前台
<Grid>
<ListBox Name="list"></ListBox>
</Grid>
后台
public MainWindow()
{
InitializeComponent();
this.list.ItemsSource = ReadFiles(@"D:\");
}
//using System.IO;
public string[] ReadFiles(string Folder)
{
List<string> ss = new List<string>();
foreach (var v in Directory.GetFiles(Folder, "*.xml"))
{
ss.Add(v);
}
return ss.ToArray();
}
<Grid>
<ListBox Name="list"></ListBox>
</Grid>
后台
public MainWindow()
{
InitializeComponent();
this.list.ItemsSource = ReadFiles(@"D:\");
}
//using System.IO;
public string[] ReadFiles(string Folder)
{
List<string> ss = new List<string>();
foreach (var v in Directory.GetFiles(Folder, "*.xml"))
{
ss.Add(v);
}
return ss.ToArray();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询