Why won't my WPF XAML Grid TranslateTransform.X ?

Posted by George on Stack Overflow See other posts from Stack Overflow or by George
Published on 2010-04-12T11:41:11Z Indexed on 2010/04/12 11:53 UTC
Read the original article Hit count: 228

Filed under:
|
|

I'm able to change the width/height of the grid using this, so why won't it work when I use (Grid.RenderTransform).TranslateTransform.X as such:

<Window.Triggers>
 <EventTrigger RoutedEvent="Button.Click" SourceName="button">
  <BeginStoryboard>
    <Storyboard>
      <DoubleAnimation  
      Storyboard.TargetProperty="(Grid.RenderTransform).(TranslateTransform.X)" 
      From="0" To="200" Storyboard.TargetName="grid" Duration="0:0:2"
      />
    </Storyboard>
  </BeginStoryboard>
 </EventTrigger>
</Window.Triggers>

The application loads etc, but nothing happens when the button is clicked.

Here is the XAML for my grid:

    <Grid x:Name="grid" Height="714" Canvas.Left="240" Canvas.Top="8" Width="360" RenderTransformOrigin="0.5,0.5">
         <Grid.Background>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
           <GradientStop Color="Black" Offset="0"/>
           <GradientStop Color="White" Offset="1"/>
          </LinearGradientBrush>
         </Grid.Background>
         <Grid.ColumnDefinitions>
          <ColumnDefinition Width="0*"/>
          <ColumnDefinition/>
         </Grid.ColumnDefinitions>
     </Grid>

Note that I've tried many different Canvas.Left values, to no avail.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml