The solution that works best for me is to use the Popup primitive. It does not provide much control over the animation (it comes with stock animation), but you can animate its contents in any way you like.
<Image Name="icon" Source="{Binding MaiImaeg}"> <Image.Triggers> <EventTrigger RoutedEvent="Image.MouseEnter"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="tranny" Storyboard.TargetProperty="ScaleX" To="6" Duration="0:0:1"> <DoubleAnimation.EasingFunction> <ElasticEase Oscillations="1" Springiness="8" /> </DoubleAnimation.EasingFunction> </DoubleAnimation> <DoubleAnimation Storyboard.TargetName="tranny" Storyboard.TargetProperty="ScaleY" To="6" Duration="0:0:1"> <DoubleAnimation.EasingFunction> <ElasticEase Oscillations="1" Springiness="8" /> </DoubleAnimation.EasingFunction> </DoubleAnimation> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="Image.MouseLeave"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="tranny" Storyboard.TargetProperty="ScaleX" To="0" Duration="0:0:0" /> <DoubleAnimation Storyboard.TargetName="tranny" Storyboard.TargetProperty="ScaleY" To="0" Duration="0:0:0" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Image.Triggers> </Image> <Popup Name="popup" IsOpen="{Binding IsMouseOver, ElementName=icon, Mode=OneWay}" PlacementTarget="{Binding ElementName=icon}" Placement="Left" Width="640" Height="640" StaysOpen="true" AllowsTransparency="True"> <Image Width="48" Height="48" Source="{Binding MaiImaeg}"> <Image.RenderTransform> <ScaleTransform x:Name="tranny" CenterX="48" CenterY="24" ScaleX="1" ScaleY="1" /> </Image.RenderTransform> </Image> </Popup>
In this fragment, the pop-up window is not open until IsMouseOver is true for its image (with the name "icon"). When a mouse enters an image, two things happen. A popup window opens (at 640x640) and an image is displayed (48px at 48px). This image has a large scale conversion. The image "icon" also has a storyboard for MouseEnter and MouseLeave. This storyboard uses dual animation designed for a ScaleTransform popup. This storyboard enlarges the image when the mouse enters and squeezes it when it leaves with a good attenuation function.
Use case: “The user presents a list with small images for each item in the list. When the user hovers over a small image (icon), it appears forward and enlarged, giving the user a better view of the image. When the mouse leaves the image, it shrinks to its original size. "
Will
source share