I’m using the latest Avalon dock manager under WPF. I’d like to use DirectX to draw some things in the unused area in the center. The space I’m talking about is the area when there isn’t any pane. For example, say you have a bottom side panel in the dock control and thats it. The area above it is unused. I want to draw in that space.
The trouble is that I can’t get the dimensions of this space. The code below is what I’m trying to use to get the dimensions of the area, but it doesn’t work. In the case where I only have a bottom side panel, the Width is always NaN and the ActualHeight is 0.
private Rect getUnusedDockpanelArea()
{
Point dockManagerTopLeft = dockManager.TranslatePoint(new Point(0, 0), mainWindow);
Rect r = new Rect();
r.Y = dockManagerTopLeft.Y * 1.3;
r.X = dockManagerTopLeft.X;
r.Width = dockManager.ActualWidth;
if (dockManager.LeftSidePanel != null)
r.Width -= dockManager.LeftSidePanel.Width;
if (dockManager.RightSidePanel != null)
r.Width -= dockManager.RightSidePanel.Width;
r.Height = dockManager.ActualHeight;
if (dockManager.BottomSidePanel != null)
r.Height -= dockManager.BottomSidePanel.Height;
return r;
}