1

I am creating panels in code in this way:

DockableContent dockableContent = CreateDockableContent<TView>(model);
dockableContent.Show(_dockingManager, AnchorStyle.Bottom);

How can I specify the initial height for that panel? The following doesn't work:

dockableContent.Height = 400;

or

ResizingPanel.SetResizeHeight(dockableContent, new GridLength(400));
EgorBo
  • 6,120
  • 3
  • 35
  • 40

3 Answers3

5

For the panel with fixed height set DockMinHeight="120" and DockHeight="1*". For other panel set DockHeight="90*".

In this case, panel with fixed height will become so short, that DockMinHeight will be used.

Nerijus G
  • 918
  • 13
  • 28
3

For Avalon Dock 2.0 there is some internal code that will automatically resize the DockWidth / DockHeight to star-size. Which stops you from having a fixed/initial height/width panel in a vertical / horizontal group pane.

The only fix at the moment I can see is to comment out this behavour from the AvalonDock Source code. Namely; in OnFixChildrenDockLengths of class LayoutAnchorablePaneGroupControl

Hope this helps.

Meirion Hughes
  • 24,994
  • 12
  • 71
  • 122
1

Nagg,

Setting the height of the panel only affects its appearance when floating. When it is docked, it is bound by the limits of Resizing panel (looks like you figured that out yourself).

Resizing panels are created with a default size in the AvalonDock library.

You might want to look into version 2.0 of AvalonDock - it offers way more flexibility in customizing Panels - especially because they can be bound to a ViewModel where you can change their appearance.

If you still want to use 1.3 then you'd have to modify the AvalonDock source code to get it to do what you want (add in a default panel height for example).

Steve

samneric
  • 3,038
  • 2
  • 28
  • 31
  • 3
    Thank you for your answer, Steve. I found the solution: the DockablePane is created _after_ DockableContent.Show is called so I can assign ResizingPanel.SetResizeHeight for it and it works! – EgorBo Mar 20 '12 at 17:50