DockPanel Suite: Dynamically set FloatWindow's MaximizeBox and MinimizeBox

256 Views Asked by At

I'm farily new to DockPanel Suite. I have created a custom FloatWindow and IFloatWindowFactory like this:

public class MapFloatWindowFactory : DockPanelExtender.IFloatWindowFactory
{
    public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
    {
        return new MapFloatWindow(dockPanel, pane, bounds);
    }

    public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane)
    {
        return new MapFloatWindow(dockPanel, pane);
    }
}
public class MapFloatWindow : FloatWindow
{
    public MapFloatWindow(DockPanel dockPanel, DockPane pane) : base(dockPanel, pane)
    {
        FormBorderStyle = FormBorderStyle.Sizable;
    }

    public MapFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds) : base(dockPanel, pane, bounds)
    {
        FormBorderStyle = FormBorderStyle.Sizable;
    }
}

However with this approach, the MaximizeBox and MinimizeBox property of my DockContent is not respected. How would I implement this?

1

There are 1 best solutions below

0
On

As per DockPanel Suite documentation (http://docs.dockpanelsuite.com/en/latest/tutorials/customizing-floatwindow.html), you really need to create a custom float window factory:

Next, create a factory class to create the CustomFloatWindow. This is done by implementing the IFloatWindowFactory interface,

public class CustomFloatWindowFactory :
        DockPanelExtender.IFloatWindowFactory
{
    public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
    {
        return new CustomFloatWindow(dockPanel, pane, bounds);
    }

    public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane)
    {
        return new CustomFloatWindow(dockPanel, pane);
    }
} 

Lastly, attach the new factory to the DockPanel control,

this.dockPanel.Extender.FloatWindowFactory = new CustomFloatWindowFactory();