Loaded event inside DataTemplate.Triggers not working properly
Posted: 07 Sep 2021, 13:18
Hi,
I have ran into a problem which I believe to be a bug. I have put a "Loaded" RoutedEvent EventTrigger inside of my DataTemplate to play a storyboard. The xaml works properly in WPF, but it desn't work in Noesis. I am getting the following error:
You can see the xaml code below. The item source of the listbox is set in code behind.
I have managed to work around this issue for now by using the triggers inside stackpanel instead, like so.
I have ran into a problem which I believe to be a bug. I have put a "Loaded" RoutedEvent EventTrigger inside of my DataTemplate to play a storyboard. The xaml works properly in WPF, but it desn't work in Noesis. I am getting the following error:
Code: Select all
[NOESIS/E] <memory>(26): Unknown event 'Loaded' setting EventTrigger.RoutedEvent.
Code: Select all
<Window x:Class="GlutMenu.MainWindow"
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"
mc:Ignorable="d"
Background="#FF000000"
Title="MainWindow" Height="1080" Width="1920" Focusable="False">
<Window.Resources>
<DataTemplate x:Key="MessageItemTemplate">
<DataTemplate.Resources>
<Storyboard x:Key="ItemShownStoryboard">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Info_Box" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:03" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:03.7" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</DataTemplate.Resources>
<StackPanel x:Name="Info_Box" RenderTransformOrigin="0.5,1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Opacity="1" Background="#FFEE5858">
<TextBlock Text="{Binding}">
</TextBlock>
</StackPanel>
<DataTemplate.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard Storyboard="{StaticResource ItemShownStoryboard}" />
</EventTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</Window.Resources>
<Grid>
<ListBox x:Name="mainListBox" ItemTemplate="{StaticResource MessageItemTemplate}" Background="#FFF0E3E3" BorderBrush="{x:Null}" Margin="0,0,828,228" />
</Grid>
</Window>
Code: Select all
<StackPanel.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource ItemShownStoryboard}" />
</EventTrigger>
</StackPanel.Triggers>