locked
Trigger not responding to MouseLeftButtonDown RRS feed

  • Question

  • Using the current EB4RC, when i use MouseLeftButtonDown on an image, it doesn't work. MouseLeftButtonUp does though. Is this by design?
    Sunday, May 2, 2010 2:54 PM

All replies

  • We will need more information to help out. For example, the following XAML works just fine for me (i.e. I am able to run the animation when the user clicks on the image):

    <UserControl
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" mc:Ignorable="d"
     x:Class="SilverlightApplication3.MainPage"
     Width="640" Height="480">
     <UserControl.Resources>
      <Storyboard x:Name="Storyboard1">
       <DoubleAnimation Duration="0:0:1" To="426" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
       <DoubleAnimation Duration="0:0:1" To="-9" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
      </Storyboard>
     </UserControl.Resources>

     <Grid x:Name="LayoutRoot" Background="White">
      <Image Margin="169,61,197,203" Source="/Jellyfish.jpg" Stretch="Fill">
       <i:Interaction.Triggers>
        <i:EventTrigger EventName="MouseLeftButtonDown">
         <ei:ControlStoryboardAction Storyboard="{StaticResource Storyboard1}"/>
        </i:EventTrigger>
       </i:Interaction.Triggers>
      </Image>
      <Rectangle x:Name="rectangle" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="103" Margin="50,0,0,48" Stroke="Black" VerticalAlignment="Bottom" Width="130" RenderTransformOrigin="0.5,0.5">
       <Rectangle.RenderTransform>
        <CompositeTransform/>
       </Rectangle.RenderTransform>
      </Rectangle>
     </Grid>
    </UserControl>


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Sunday, May 2, 2010 7:21 PM