0
我有一个WPF对话框,其上有一个DataGrid。我想要做的是能够将文件或文件夹放到Datagrid上并显示信息。每一行代表每个文件。对于我的生活,我无法弄清楚如何插入数据并显示行。DataGrid拖放
这里是下降代码...
public partial class SplitWindow : UserControl
{
public SplitWindow()
{
this.InitializeComponent();
}
private void FilesDropped(object sender, System.Windows.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
DropDataGrid.Items.Clear();
string[] droppedFilePaths = e.Data.GetData(DataFormats.FileDrop, true) as string[];
foreach (string droppedFilePath in droppedFilePaths)
{
string name = System.IO.Path.GetFileNameWithoutExtension(droppedFilePath);
// insert row???
}
}
}
}
你能给我一个编码样本吗? – Craig