111,126
社区成员
发帖
与我相关
我的任务
分享
public partial class FileSendPage : Page
{
static string sendname;
List<FileCommon> FileList = new List<FileCommon>();//用来绑定到Datagrid上的数据源
public FileSendPage()
{
InitializeComponent();
}
//选择文件
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
FileCommon fc = new FileCommon();//文件类:包括文件名、文件类型、文件大小、文件路径4个字段
fc= DataService.SelectFile();//该方法实现选择文件,并将文件的信息放入fc中
if (fc.TextName != "")
{
FileList.Add(fc);
BindToDG();
}
}
//删除选中文件
private void btnDelete_Click(object sender, RoutedEventArgs e)
{
FileCommon fc = new FileCommon();
fc = dgFile.SelectedItem as FileCommon;
dgFile.SelectedItems.Clear();
}
//绑定DataGrid的数据源
void BindToDG()
{
if (FileList.Count != 0)
{
dgFile.ItemsSource = FileList;
}
}
}