Rotate Window

Hello

Is it possible to rotate a window with WPF.
When i have this on my main window

<Window.RenderTransform>
<RotateTransform CenterX="0" CenterY="0" Angle="45"/>
</Window.RenderTransform>

i get
Error at element 'BamlAttributeInfoRecord' in markup file 'Window1.xaml' : Transform is not supported on Window..

kind regards
Dieter


Answer this question

Rotate Window

  • the_Djinn

    What are these 0x0093 , 0x0092 and 0x0091 messages Smile
  • pena_a

    Yes.

  • Itsme850

    At some PDC there was a Sample with Notepad window rotating and jumping around the desktop.
  • Jiffy

    I did actually say compatibility, though the reason is subtle: if you can present a window rotated by 45 degrees, then Win32's GetWindowRect can't return anything meaningful for the position of that window. That doesn't seem like a big problem until you start considering things like drag-and-drop, which require inter-process communication of coordinates that can be transformed to and from screen coordinates and between windows. This is just an example, of course -- there are many others that are even more subtle and yet harder to solve. It's not an impossible problem, but the bottom line is that we didn't feel it was worth the effort to chase down all of the details that have to be gotten right to provide a sensible, consistent, reliable programming model this time around.

    Of course, as you noted, this says nothing about the display capabilities of the Desktop Window Manager. Some of the early demos we showed really were meant solely to demonstrate the power of the composition engine. We could wrap the windows around tea pots if we wanted, but we thought that would be a poor story from a usability point of view Wink.



  • Andrew Oliver

    Drew Marsh wrote:
    That was the DWM (desktop window manager) doing that. See Leonardo's post above for more details on that.

    As I understand Leonardo's post, DWM can do this, but it don't make it because of compatibility. How could then DWM do this in the sample


  • WeldFire

    This is especially true if the machine is running with the Classic theme, which doesn't use the desktop compositor. In that case, GDI is drawing the frames.

    If the new glass theme is used, then WPF is also drawing the non-client area under the covers (though that happens in the context of the Desktop Window Manager). If you have a normal, full window WPF application, that is, not a browser-hosted application or a control in a child window, then at that point the entire window is being drawn by WPF. Even in that scenario, however, we do not expose a way to apply arbitrary transformations to the window as a whole, because we couldn't then maintain either consistency during a theme switch, or compatibility with Win32 window querying and manipulation functions.



  • zcz

    Leonardo,

    Ahh, the example you just gave makes the compatibility argument clearer, thanks. The DWM could still do nice transition animations for things like windows being minimized/maximized since the window is not really interactive during those times right You can also scale windows because you would just reduce their Rect , right I haven't been able to run Vista except in VPC, so I don't know what exactly ended up making it in from the Aero experience perspective yet.

    In the end it's still all about usability, but if you take OSX's min/max animations and "live" windows on the dock bar... I think it's a pretty good example of adding some "pizazz" while also providing a richer user experience.

    Cheers,
    Drew


  • Sanket Shah

    Well, first of all, it was probably a tech-demo since there's no obvious useful reason to actually have Windows do this. :) That said I don't see where Leonardo said anything about not making it because of compatibility...

    I haven't had Vista running on real hardware yet (only VPCs), but the DWM still offers a lot of "snazzy" features like compositing the windows and doing the cool 3D ALT+Tab shuffle. Basically, whatever the DWM itself can technically do really doesn't matter because there is no open API for manipulating it. So you won't be able to write a "behavior" to rotate windows anytime soon.

    Cheers,
    Drew


  • Whitey

    Is the window in Windows Vista also renderd with GDI



  • CSFDeveloper

    You cannot apply any transforms to the Window because the Window chrome is still rendered by GDI right now.

    HTH,
    Drew


  • Carlos90210

    That was the DWM (desktop window manager) doing that. See Leonardo's post above for more details on that.
  • Terry Nguyen

    That is exactly how the DWM works -- it's a special full-screen WPF application that hosts all other windows in the system, and therefore has access to all WPF capabilities to display those windows in all kinds of interesting ways. This makes the Flip3D view and the open/close/minimize/restore animations possible, as well as a few other things you can see in the build like previews in the taskbar and in the new Alt+Tab view.

    For the purposes of special transition effects or these new productivity features, the sky is the limit because all we need to do is change the graphical output. When it comes to exposing a way for applications to more premanently set their window properties, things are trickier because we have to worry about all other APIs that manipulate windows, as well as mouse input and the behavior of those windows when the desktop compositor is turned off.

    So, the DWM can definitely implement visually all kinds of interesting effects, but that capability isn't exposed to applications because other subsystems that we haven't replaced in Windows Vista aren't able to deal with arbitrarily rotated or skewed windows (let alone windows mapped to 3D surfaces).



  • Labm1ce

    Well, honestly, I'd like to know when Windows will have this capability; maybe like a MacOS X window effect. I wonder...

  • rradtke

    Make Avalon window fullscreen, draw Windows (OS) inside and you can do anything

  • Rotate Window