Drew Marsh wrote:
> Jason Dolinger wrote:
>
>> So how is this done in Sparkle? When you use the workspace zoom
>> slider in Sparkle, all of the child windows scale up or down. Isn't
>> Sparkle a 100% WPF application?
>
>
> Just going from memory since I don't have time to load it up right now,
> there are no "real" windows inside of Sparkle. It's not a true MDI
> interface, it's all custom UI elements. So when they scale they're
> scaling 100% pure WPF content.
>
> HTH,
> Drew
> ___________________________________
> Drew Marsh
> Chief Software Architect
> Mimeo.com, Inc. - http://www.mimeo.com
> Weblog - http://blog.hackedbrain.com/
>
>
Still hacking away at this one... I understand that the window borders,
title bar, etc. are still drawn by Win32 so there really isn't anything
in the WPF API that I could use to accomplish this. I can live with
that. I'll actually be fine turning off the borders for the windows
(Setting the WindowStyle to "None"). But I still need the window
"insides" to scale down. Like I said, I can actually get the content to
scale down nicely, but then I'm left with black space blanking out the
remaining area where the window was (do I somehow need to kick Windows
to tell it to redraw the desktop or something?).
Anyway, trying to dig a little deeper, I wrote a program to print out
the visual tree of a window and have noticed that every WPF window has
the following hierarchy created by the framework before it starts
inserting your own layout controls, etc... (it prints the type of each
element in the tree plus the name if one exists) :
<whatever your window class is>, Name:
Visual Type: System.Windows.Controls.Border, Name:
Visual Type: System.Windows.Controls.Grid, Name:
Visual Type: System.Windows.Documents.AdornerDecorator, Name:
Visual Type: System.Windows.Controls.ContentPresenter, Name:
*** user defined layout and controls start here... ***
So I also tried playing around with everything i could possibly think
of, applying to ScaleTransform to each of this subelement rather than
the Window (no luck there), and then trying to bind the Height and Width
of the Window to the ActualHeight and ActualWidth of each of these
elements in turn (and then tried changing their ActualHeights and
Widths). I noticed a few things during this testing:
- Height and Width of each of these elements is always NaN. This could
be because these are the suggested values and I haven't defined any.
- ActualHeight and ActualWidth of each of these elements NEVER changes.
I'd have thought that when I applied my scale transform to the
window, that SOMETHING would change. I thought for sure that at least
the ContentPresenter (the last level of framework defined visual in the
tree before inserting the user defined content) ActualWidth and
ActualHeight would be changing, to provide a bounds on the actual window
content that was scaling. Then it would only be a matter of binding the
window's height and width to these values. But no dice, they never
change.
Is it possible that I'm having problems because there is a Grid in that
hierachy, and the system automatically handles the layout? Should I
override that portion of the visual tree with a canvas (if that is
possible). I feel like there must be some magic combination of setting
Height and Width properties at the correct visual tree level that will
fix my problem. Should I be looking at using the ClipToBounds method to
cutoff all extra content except for my scaled window content? Should I
give up!???
Thanks for any help, it's always appreciated!
Jason