Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - How to get the "client area" of a window?

 
 
Old 02-24-2006   #1 (permalink)
fö


 
 

How to get the "client area" of a window?

When a window is resized the SizeChangedEventArgs only give
me the new size of the whole window including title and borders.
How do I get the width and height of what was formerly known as
"client area" of a window? In GDI the answer was given by
GetClientRect(). What's it in WPF?

My System SpecsSystem Spec
Old 02-24-2006   #2 (permalink)
Drew Marsh


 
 

Re: How to get the "client area" of a window?

fo wrote:

> When a window is resized the SizeChangedEventArgs only give me the new
> size of the whole window including title and borders. How do I get the
> width and height of what was formerly known as "client area" of a
> window? In GDI the answer was given by GetClientRect(). What's it in
> WPF?


You can get the ActualWidth/Height of the window's content (the root) element.

HTH,
Drew

___________________________________
Drew Marsh
Chief Software Architect
Mimeo.com, Inc. - http://www.mimeo.com
Microsoft C# / WPF MVP
Weblog - http://blog.hackedbrain.com/


My System SpecsSystem Spec
Old 03-01-2006   #3 (permalink)
fö


 
 

Re: How to get the "client area" of a window?

Well, it's just the other way around: I want to resize the
window's root element (a canvas) to its client area. So
I'd better ask how to do this.

Thanks,
fö

"Drew Marsh" wrote:

> fo wrote:
>
> > When a window is resized the SizeChangedEventArgs only give me the new
> > size of the whole window including title and borders. How do I get the
> > width and height of what was formerly known as "client area" of a
> > window? In GDI the answer was given by GetClientRect(). What's it in
> > WPF?

>
> You can get the ActualWidth/Height of the window's content (the root) element.
>
> HTH,
> Drew
>
> ___________________________________
> Drew Marsh
> Chief Software Architect
> Mimeo.com, Inc. - http://www.mimeo.com
> Microsoft C# / WPF MVP
> Weblog - http://blog.hackedbrain.com/
>
>
>

My System SpecsSystem Spec
Old 03-01-2006   #4 (permalink)
Drew Marsh


 
 

Re: How to get the "client area" of a window?

fö wrote:

> Well, it's just the other way around: I want to resize the window's
> root element (a canvas) to its client area. So I'd better ask how to
> do this.


Perhaps I don't undersand, this should be automatic. The Window always stretches
its content to fit the client area. Do you have a screenshot of what you're
experiencing vs. what you're expecting?

Cheers,
Drew


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Plug a cable into network adaptor "Local Area Connection"?? .NET General
Plug a cable into network adapter "local area connection" Network & Sharing
Shortcut changes when changing attribute from "Normal window" to "Maximized" Vista General
Vista style status bar and preview area in "find file" window Vista General
Where are settings for "Confirm after download" & "in same window" Vista performance & maintenance


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46