Reputation: 1225
I have a WPF dialog with a DataGrid on it. What I want to do is be able to drop a file or folder onto the Datagrid and have the information show up. Each row will represent each file. For the life of me I can't figure out how to insert the data and have the rows show up.
Here is the drop code...
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???
}
}
}
}
Upvotes: 0
Views: 424
Reputation: 4563
You'll have to mess around with the xaml to get things to look right.
Upvotes: 1