How to play Storyboard on MouseEnter event?
I've been trying to start the storyboard on MouseEnter. It works in C#, but it doesn't work outside Visual Studio, such as in Unreal Engine.
How do I approach this? I want to call a C# event whenever the MouseEnter event is triggered, but when played from Unreal Engine.
How do I approach this? I want to call a C# event whenever the MouseEnter event is triggered, but when played from Unreal Engine.
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: How to play Storyboard on MouseEnter event?
I've tested the following xaml in Unreal and when I hover the rectangle it changes the color to green, and goes back to red when moving the mouse out of the rectangle:
Is this what you were trying?
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions">
<Grid.Resources>
<Storyboard x:Key="animEnter">
<ColorAnimation To="Lime" Storyboard.TargetName="rect" Storyboard.TargetProperty="Fill.Color"/>
</Storyboard>
<Storyboard x:Key="animLeave">
<ColorAnimation To="Red" Storyboard.TargetName="rect" Storyboard.TargetProperty="Fill.Color"/>
</Storyboard>
</Grid.Resources>
<Rectangle x:Name="rect" Width="300" Height="100" Fill="Red">
<b:Interaction.Triggers>
<b:EventTrigger EventName="MouseEnter">
<b:ControlStoryboardAction Storyboard="{StaticResource animEnter}"/>
</b:EventTrigger>
<b:EventTrigger EventName="MouseLeave">
<b:ControlStoryboardAction Storyboard="{StaticResource animLeave}"/>
</b:EventTrigger>
</b:Interaction.Triggers>
</Rectangle>
</Grid>Who is online
Users browsing this forum: No registered users and 6 guests