I am working with Visual Studio 2010, developing an Extension
I need to drag and drop from a WPF TreeView in a Toolwindow onto a DSL Diagram but when I call e.data.GetData I can not get a value and want to know what I am doing wrong
private void OnDragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(SqlServerTable)))
{
try
{
SqlServerTable table = (SqlServerTable)e.Data.GetData(typeof(SqlServerTable));
MessageBox.Show(table.Name);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
The first if statement resolves as True. This would tell me that it is that sort of Object. This is what is in the WPF Tree view:
private void DataSourceExplorerTreeView_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
if (DataSourceExplorerTreeView.SelectedValue is TableViewModel)
{
Table table = ((TableViewModel)DataSourceExplorerTreeView.SelectedValue).Table;
DragDrop.DoDragDrop(DataSourceExplorerTreeView, table, DragDropEffects.Copy);
}
}
}
SqlServerTable inherits from Table. If I stick a breakpoint in and call
e.Data.GetFormats()
I can see my Fully qualified TypeName