Windows Vista Forums

Is there a rotation guide somewhere? With impact on height and width?
  1. #1


    Philippe Lavoie Guest

    Is there a rotation guide somewhere? With impact on height and width?

    Hi

    I'm having a hell of a time understanding how to effectively use
    rotations with Xaml. Is there a resource on the web for this?

    Rotation, is easy, however the effect of it on bounding box is really not.

    For instance, I get an image from the web which is 100x800 and I want to
    show it with a -90 rotation then scaled down to 200 pixels. Actually, I
    don't know the exact values of the original image, I just know that 200
    pixels is the target.

    Simply saying rotate by -90 is useless on the image because the width
    and height are not also adjusted by the rotated content.

    I had to do the following:


    <Canvas Width="190" Height="27"
    <Image Canvas.Left="185" Canvas.Top="10" Width="Auto" Height="180"
    Source="{Binding Path=ImageUri}" HorizontalAlignment="Stretch"
    VerticalAlignment="Center" Grid.RowSpan="1" Grid.ColumnSpan="2"
    MinWidth="0" MinHeight="0" ClipToBounds="False" Margin="0,0,0,0"
    IsEnabled="True">
    <Image.RenderTransform>
    <TransformGroup>
    <RotateTransform Angle="90"/>
    </TransformGroup>
    </Image.RenderTransform>
    </Image>
    </Canvas>


    Now my problem was that I wanted to improve on my current design. Which
    for now simply show a sk product as (where xXXXXXx is the image of a ski
    or something like that)

    xXXXXXXXXXXXXXXxx
    Name $10
    Description

    To improve on it. I wanted to rotate the whole content of it without a
    description.

    x $
    X 1
    X 0
    X
    X n
    X a
    X m
    x e

    Then when the user clicks or hovers, rotate the content to show

    xXXXXXXXXXXXXXXxx
    Name $10
    Description of
    product

    field A: babd
    field B: baddfas

    My current approach just doesn't work. The new width, height of the
    rotated content are not known by the system (or something) and the
    rotated content just doesn't fit inside the new box (without manually
    adjusting a Top part and putting everything in a fixed sized canvas).

    Please help.

    Phil




      My System SpecsSystem Spec

  2. #2


    Adam Smith [MS] Guest

    Re: Is there a rotation guide somewhere? With impact on height and width ?

    Since you want layout to respond to your Transform - rather than just
    applying a Transform which only affects rendering - consider using
    LayoutTransform rather than RenderTransform. This will apply the transform
    on the input to the layout process rather than the output. Depending on
    what you're doing, you should be good to go.

    -Adam Smith [MS]

    "Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message
    news:eQxtRIqTGHA.1672@tk2msftngp13.phx.gbl...
    > Hi
    >
    > I'm having a hell of a time understanding how to effectively use rotations
    > with Xaml. Is there a resource on the web for this?
    >
    > Rotation, is easy, however the effect of it on bounding box is really not.
    >
    > For instance, I get an image from the web which is 100x800 and I want to
    > show it with a -90 rotation then scaled down to 200 pixels. Actually, I
    > don't know the exact values of the original image, I just know that 200
    > pixels is the target.
    >
    > Simply saying rotate by -90 is useless on the image because the width and
    > height are not also adjusted by the rotated content.
    >
    > I had to do the following:
    >
    >
    > <Canvas Width="190" Height="27"
    > <Image Canvas.Left="185" Canvas.Top="10" Width="Auto" Height="180"
    > Source="{Binding Path=ImageUri}" HorizontalAlignment="Stretch"
    > VerticalAlignment="Center" Grid.RowSpan="1" Grid.ColumnSpan="2"
    > MinWidth="0" MinHeight="0" ClipToBounds="False" Margin="0,0,0,0"
    > IsEnabled="True">
    > <Image.RenderTransform>
    > <TransformGroup>
    > <RotateTransform Angle="90"/>
    > </TransformGroup>
    > </Image.RenderTransform>
    > </Image>
    > </Canvas>
    >
    >
    > Now my problem was that I wanted to improve on my current design. Which
    > for now simply show a sk product as (where xXXXXXx is the image of a ski
    > or something like that)
    >
    > xXXXXXXXXXXXXXXxx
    > Name $10
    > Description
    >
    > To improve on it. I wanted to rotate the whole content of it without a
    > description.
    >
    > x $
    > X 1
    > X 0
    > X
    > X n
    > X a
    > X m
    > x e
    >
    > Then when the user clicks or hovers, rotate the content to show
    >
    > xXXXXXXXXXXXXXXxx
    > Name $10
    > Description of
    > product
    >
    > field A: babd
    > field B: baddfas
    >
    > My current approach just doesn't work. The new width, height of the
    > rotated content are not known by the system (or something) and the rotated
    > content just doesn't fit inside the new box (without manually adjusting a
    > Top part and putting everything in a fixed sized canvas).
    >
    > Please help.
    >
    > Phil
    >




      My System SpecsSystem Spec

Is there a rotation guide somewhere? With impact on height and width? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Animating Width/Height to an auto value Ramon de Klein Avalon 0 27 May 2008
How to resize (height/width) an avi in Windows Movie Maker Dusty Vista music pictures video 5 16 Nov 2007
High Impact Problems What are They? Grant Vista General 1 11 Feb 2007
How to implement percent height & width in a custom control? joan Avalon 1 08 May 2006
Width and Height values in markup CosminB [BRT] Avalon 2 21 Apr 2006