Programatically Add FloatingWindow

Jun 25, 2008 at 7:31 PM
I have an application that has a lot of toolboxes.  I want to crate a floating window programmatically but I'm having a difficult time figuring it out.  What is the best way to do this?
Jun 25, 2008 at 8:07 PM
Edited Jun 25, 2008 at 8:09 PM
I thought I was on to something with this but I get a null refrence in AvalonDoc when I create the floatingwindow

Dim dc As New AvalonDock.DockableContent
With dc 
    .Content = New ImageDeviceBaseToolBox 
    .Title = "Camera"
End With
Dim foo As New AvalonDock.DockableFloatingWindow(MainDockingManager, dc)
Jun 26, 2008 at 3:17 PM

Hi, when you create a DockableContent be sure to put it into a parent pane (DockablePane or DocumentPane), then call DockingManager.Show() to show the content into a FloatingWindow. In this way AvalonDock knows which pane previously contained the content.

Code:
DockableContent cnt = new DockableContent();

 

cnt.Content =

new TextBox();

 

cnt.Title =

"Camera";

 

 

DockablePane pane = new DockablePane();

 

pane.Items.Add(cnt);

_dockingManager.Show(cnt,

DockableContentState.Document);

 

_dockingManager.Show(cnt,

DockableContentState.FloatingWindow);

 

 

FloatingWindow fltWindow = Window.GetWindow(cnt) as FloatingWindow;

 

fltWindow.Left = 100;

fltWindow.Top = 100;

fltWindow.Width = 300;

fltWindow.Height = 300;

Jun 30, 2008 at 3:15 PM
Thanks, works like a charm!

adospace wrote:

Hi, when you create a DockableContent be sure to put it into a parent pane (DockablePane or DocumentPane), then call DockingManager.Show() to show the content into a FloatingWindow. In this way AvalonDock knows which pane previously contained the content.

Code:
DockableContent cnt = new DockableContent();

 

cnt.Content =

 

new TextBox();

 

cnt.Title =

 

"Camera";

 

 

 

DockablePane pane = new DockablePane();

 

pane.Items.Add(cnt);

_dockingManager.Show(cnt,

 

DockableContentState.Document);

 

_dockingManager.Show(cnt,

 

DockableContentState.FloatingWindow);

 

 

 

FloatingWindow fltWindow = Window.GetWindow(cnt) as FloatingWindow;

 

fltWindow.Left = 100;

fltWindow.Top = 100;

fltWindow.Width = 300;

fltWindow.Height = 300;

 




Oct 7, 2011 at 2:01 AM

Hmm... i have a similar problem... (wanna create a new DockablePane and display it in a window)

But it seems as if the DockingManager.Show() method isn't there anymore o.O

 

How to solve this problem now?

Aug 20, 2014 at 11:51 AM
I am able to dynamically create floating window.

var pane = new LayoutAnchorablePane();
var a = new LayoutAnchorable();
w.Title = "New Window";
a.Content = new Window1();
la.Content = new OEWindow3(new List<string>());
pane.Children.Add(la);
layoutPanel.Children.Add(pane); // layoutPanel is the element under LayoutRoot where we are adding the window.

la.FloatingHeight = 350;
la.FloatingWidth = 500;
la.Float();

for more information please see documentation.