Reputation: 690
WPF includes the title bar height in the total window height instead of using only the client content area height.
I'm aware of the SystemParameters.CaptionHeight property and the SystemParameters.WindowCaptionHeight property but they both return the height of a regular window title bar. This is not the correct value for a tool window because the title bar is smaller for this type of window. I need something like SystemParameters.ToolWindowCaptionHeight
Thanks.
Upvotes: 2
Views: 5392
Reputation: 292415
The size of the client area is the actual size of the window's root element :
public double ClientWidth
{
get { return ((FrameworkElement)this.Content).ActualWidth; }
}
public double ClientHeight
{
get { return ((FrameworkElement)this.Content).ActualHeight; }
}
Upvotes: 5
Reputation: 43595
You could fall back to System.Windows.Forms.SystemInformation.ToolWindowCaptionHeight. Although it is in the WinForms namespace, it is hardly a WinForms only class.
Upvotes: 1