This is a migrated thread and some comments may be shown as answers.

Storyboard was never applied to this object for interactive control

6 Answers 544 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 10 Nov 2016, 09:41 PM

I saw there was a post about this several years back, but the OP never followed up..

I am getting the " System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='11303829'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='11303829'; TargetElement.Type='System.Windows.Media.Animation.Storyboard' "

 

I have tried everything I can think of (hopefully not missing something small and silly..).  

Here is the storyboard itself in the UserCont

<Storyboard x:Key="FlashingPanel" RepeatBehavior="Forever" AutoReverse="True">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                   Storyboard.TargetName="TaskPanelItem">
        <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0" />
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

 

Here is the 'grid' section that utilizes the storyboard.

<Grid Grid.Column="1" Grid.Row="1">
            <telerik:RadPanelBar x:Name="TaskRadPanel"
                                 Background="{StaticResource UserControlbackground}"
                                 Width="Auto"
                                 Height="Auto"
                                 Orientation="Horizontal"
                                 Margin="5, 8, 5, 10"
                                 BorderBrush="Transparent"
                                 FocusVisualStyle="{x:Null}"
                                 ItemContainerStyle="{StaticResource TaskRadPanelItemStyle}">
 
                <telerik:RadPanelBarItem x:Name="TaskPanelItem"
                                         HeaderTemplate="{StaticResource MyTaskHeaderTemplate}"
                                         HorizontalContentAlignment="Right">
                     
                        <telerik:RadPanelBarItem.Triggers>
                            <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                                <EventTrigger.Actions>
                                    <BeginStoryboard x:Name="MyFlashingStory" Storyboard.TargetName="TaskPanelItem"  
 Storyboard="{StaticResource FlashingPanel}"/>
                                </EventTrigger.Actions>
                            </EventTrigger>
                        </telerik:RadPanelBarItem.Triggers>
                     
                     
                        <i:Interaction.Triggers>
 
                            <ei:DataTrigger Binding="{Binding MyTeamHasTasks, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Value="True">
                                <ei:ControlStoryboardAction Storyboard="{StaticResource FlashingPanel}"
                                                        ControlStoryboardOption="Play" />
                            </ei:DataTrigger>
 
                            <ei:DataTrigger Binding="{Binding MyTeamHasTasks, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Value="False">
                                <ei:ControlStoryboardAction Storyboard="{StaticResource FlashingPanel}"
                                                        ControlStoryboardOption="Pause" />
                            </ei:DataTrigger>
 
                            <i:EventTrigger EventName="Expanded" SourceName="TaskPanelItem">
                            <ei:ControlStoryboardAction Storyboard="{StaticResource FlashingPanel}"
                                                        ControlStoryboardOption="Stop" />
                        </i:EventTrigger>
                         
                        <i:EventTrigger EventName="Collapsed" SourceName="TaskPanelItem">
                            <ei:ControlStoryboardAction Storyboard="{StaticResource FlashingPanel}"
                                                        ControlStoryboardOption="Play" />
                        </i:EventTrigger>
                         
                    </i:Interaction.Triggers>
                     
                    <telerik:RadListBox ItemsSource="{Binding MyTeamTaskList}" >
                        <telerik:RadListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Vertical" />
                            </ItemsPanelTemplate>
                        </telerik:RadListBox.ItemsPanel>
                        <telerik:RadListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <TextBlock Text="{Binding Description}"
                                               FontFamily="Sengo UI"
                                               FontSize="14"
                                               VerticalAlignment="Center"
                                               Foreground="RoyalBlue" />
                                </Grid>
                            </DataTemplate>
                        </telerik:RadListBox.ItemTemplate>
                    </telerik:RadListBox>
 
                </telerik:RadPanelBarItem>
            </telerik:RadPanelBar>
        </Grid>

 

MyTeamHasTasks is a boolean in my ViewModel.

 

First EventTrigger Expanded: ControlStoryboardAction: Stop  - Throws System.Windows.Media.Animation Warning: 6.

Second EventTrigger Collapsed: ControlStoryboardAction: Play - Works fine.

 

If I expand the TaskPanel again (firing the first eventtrigger from above) everything works as it should at this point and on..

 

BUT the VERY first time the ControlStoryboardAction: Stop is executed, it gives the System.Windows.Media.Animation Warning: 6.

 

For testing purposes, I replaced the binding boolean field (MyTeamHasTasks) with a checkbox and then bound the checkbox to the boolean field (MyTeamHasTasks), this route does not give me any issues...  Makes me wonder why it doesn't work they way I initially implemented it as it achieves the same thing.

 

Any idea as to how I can get around this?  I do not think this is a bug, I feel like I have possibly not implemented this accurately.

I'd like to do this without ANY code-behind.

6 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 11 Nov 2016, 04:57 PM
Hi Tyler,

I don't think that you are doing something wrong in your code. In fact everything seems correct to me. I believe (even though my fast google search for similar issues didn't brought to muy attention no specific information mentioning) that DataTrigger combined with UpdateSourceTrigger set to PropertyChanged doesn't work correctly the first time even though you have specified TwoWay Binding. 

I'd recommend that you try the PropertyChangedTrigger instead, mentioned in the Blend SDK for WPF. Here's more information about it.

Regards,
Evgenia
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Tyler
Top achievements
Rank 1
answered on 21 Nov 2016, 04:02 PM

I am not entirely sure this will work in my scenario... 

It is the "Expanded" event that I need triggered, not a property..

 

Is there yet to be a solution for this?

0
Evgenia
Telerik team
answered on 24 Nov 2016, 01:13 PM
Hi Tyler,

I'm sorry for my previous answer -- I omitted the details clearly stated in your initial post -- the Warning that you get is related to ''Stop" ControlStoryBoardOption which is about to get reached on Expanded Event and not on DataTrigger as I wrongly assumed.
Since this works as expected when you manually Expand the RadPanelBarItem (the Expanded event gets fired and so the required Storyboard kicks in) is there any chance that initially none of your RadPanelBarItem-s are Expanded? If so don't you think such warning is expected? Please correct me if I'm wrong so that we both are on the same page.

Regards,
Evgenia
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Tyler
Top achievements
Rank 1
answered on 08 Dec 2016, 08:08 PM

Let me start from the beginning.

I have a RadPanelBar.  Inside I have a single RadPanelBarItem.

On the RadPanelBarItem I have some "interaction" triggers: 

<i:Interaction.Triggers>
    <ei:DataTrigger Binding="{Binding MyTeamHasTasks, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Value="True">
        <ei:ControlStoryboardAction Storyboard="{StaticResource FlashingPanel}"
                                ControlStoryboardOption="Play" />
    </ei:DataTrigger>
    <ei:DataTrigger Binding="{Binding MyTeamHasTasks, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Value="False">
        <ei:ControlStoryboardAction Storyboard="{StaticResource FlashingPanel}"
                                ControlStoryboardOption="Pause" />
    </ei:DataTrigger>
    <i:EventTrigger EventName="Expanded" SourceName="TaskPanelItem">
        <ei:ControlStoryboardAction Storyboard="{StaticResource FlashingPanel}"
                                ControlStoryboardOption="Stop" />
    </i:EventTrigger>
    <i:EventTrigger EventName="Collapsed" SourceName="TaskPanelItem">
        <ei:ControlStoryboardAction Storyboard="{StaticResource FlashingPanel}"
                                ControlStoryboardOption="Play" />
    </i:EventTrigger>
</i:Interaction.Triggers>

 

Using this StoryBoard:

<Storyboard x:Key="FlashingPanel" RepeatBehavior="Forever" AutoReverse="True">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                   Storyboard.TargetName="TaskPanelItem">
        <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0" />
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

 

Nothing in the code behind starts nor stops the story board.  The "interaction" triggers you see are the ONLY piece of code that deals with the story board.

 

The RadPanelBarItem is NOT expanded on load, it is collapsed.

The Storyboard is started when the program starts because the binding property for the storyboard to start is triggered since the UpdateSourceTrigger=PropertyChanged.

When I expand the RadPanelBarItem for the first time, this error is displayed and the Storyboard never stops as it should.  I then collapse the storyboard and then re-expand it and the STOP trigger works as intended.

 

HOW can I get the storyboard to stop on the first "expand" event?

0
Evgenia
Telerik team
answered on 13 Dec 2016, 05:27 PM
Hello Tyler,

This is to let you know that I'll need some more time to prepare answer for you. I'll contact you as soon as there is some concrete information I can provide.

Thanks in advance for your patience and understanding.

Regards,
Evgenia
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Martin Ivanov
Telerik team
answered on 22 Dec 2016, 04:11 PM
Hi Tyler,

I prepared a small example based on your code in order to reproduce the error, but to no avail. Can you please take a look at the attached project and let me know if I am missing something?

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
General Discussions
Asked by
Tyler
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Tyler
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or