Koby Duck
Koby Duck

Reputation: 1138

Xceed AvalonDock 3.2 DockWidth/Height has no effect

I'm using AvalonDock(Extended.Wpf.Toolkit, free version) in an app for my employer. Setting DockWidth or DockHeight in either LayoutAnchorablePane or LayoutDocumentPane has no(visible) effect. Instead, each pane occupies an equivalent amount of space relative to its siblings(they default to 1*).

They can be resized at runtime with the built-in splitters, but that doesn't help programmatically or at design time. I've used some workarounds such as:

Both of which are dirty hacks that I'd like to avoid.

I'm aware that this was done in the past with ResizingPanel, but it's been long since removed. See this for related information.

I've yet to find the answer in the documentation or the source code. See my answer.

Here's a simplified example demonstrating the problem.

Upvotes: 2

Views: 760

Answers (1)

Koby Duck
Koby Duck

Reputation: 1138

This post pointed me in the right direction.

The issue is indeed internal code. The following fixed it:

  1. Add a flag to ILayoutPositionableElement.cs. I named it ForceFixedDockSize.
  2. Implement it in LayoutPositionableGroup.cs.
  3. Inside of every override of OnFixChildrenDockLengths, check if the flag is true before setting DockWidth or DockHeight.

I suspect the reason this behavior exists is to make default layouts look consistent. This change makes that behavior optional.

See my fork.

Upvotes: 1

Related Questions