Posted 15 years ago
by Andreas Boerzel
-
Software Architect,
REALTECH Software Products GmbH
Version: 9.1.0507
Platform: .NET 4.0
Environment: Windows 7 (32-bit)
Hello,
I want to create multiple AnalyzerDocuments (DocumentWindow) on the DockSite "dockSite" of my AnalyzerView (UserControl). The content of each AnalyzerDocument (DocumentWindow) also contains a DockSite "_workspace" that contains multiple CustomLayoutPanels (ToolWindow). I need to drag objects into the CustomLayoutPanels (ToolWindow) but the DragEnter and Drop events on my CustomLayoutPanel won't be fired.
Sample:
I think it's a bug!?
Is there a workaround??
Thanks Andreas
I want to create multiple AnalyzerDocuments (DocumentWindow) on the DockSite "dockSite" of my AnalyzerView (UserControl). The content of each AnalyzerDocument (DocumentWindow) also contains a DockSite "_workspace" that contains multiple CustomLayoutPanels (ToolWindow). I need to drag objects into the CustomLayoutPanels (ToolWindow) but the DragEnter and Drop events on my CustomLayoutPanel won't be fired.
Sample:
<UserControl x:Class="Realtech.ControlCenter.Client.Modules.Analyzer.AnalyzerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
mc:Ignorable="d"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
d:DesignHeight="600" d:DesignWidth="850"
MinHeight="200" MinWidth="200" >
<docking:DockSite x:Name="dockSite" >
<!-- Workspace -->
<docking:Workspace Background="Transparent">
<docking:TabbedMdiHost x:Name="tabbedMdiHost" >
<docking:TabbedMdiContainer Name="tabbedMdiContainer" />
</docking:TabbedMdiHost>
</docking:Workspace>
</docking:DockSite>
</UserControl>
public partial class AnalyzerView : UserControl
{
public AnalyzerView()
{
InitializeComponent();
AnalyzerDocument document1 = new AnalyzerDocument(dockSite);
AnalyzerDocument document2 = new AnalyzerDocument(dockSite);
AnalyzerDocument document3 = new AnalyzerDocument(dockSite);
AnalyzerDocument document4 = new AnalyzerDocument(dockSite);
tabbedMdiContainer.Items.Add(document1);
tabbedMdiContainer.Items.Add(document2);
tabbedMdiContainer.Items.Add(document3);
tabbedMdiContainer.Items.Add(document4);
}
}
public class AnalyzerDocument : DocumentWindow
{
DockSite _workspace = null;
public AnalyzerDocument(DockSite dockSite)
: base(dockSite)
{
_workspace = new DockSite();
Content = _workspace;
AllowDrop = true;
AddCustomLayoutPanel();
AddCustomLayoutPanel();
AddCustomLayoutPanel();
}
private void AddCustomLayoutPanel()
{
CustomLayoutPanel panel = new CustomLayoutPanel(_workspace);
}
}
public class CustomLayoutPanel : ToolWindow
{
Canvas _workspace = null;
Point _dropPosition = new Point();
public CustomLayoutPanel(DockSite dockSite)
: base(dockSite)
{
_workspace = new Canvas();
Content = _workspace;
AllowDrop = true;
Dock();
this.DragEnter += new DragEventHandler(OnDragOver);
this.Drop += new DragEventHandler(OnDrop);
}
private void OnDragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(string)))
{
e.Effects = DragDropEffects.Copy;
}
else
{
e.Effects = DragDropEffects.None;
}
}
private void OnDrop(object sender, DragEventArgs e)
{
_dropPosition = e.GetPosition(_workspace);
... do somthing...
}
}
Is there a workaround??
Thanks Andreas