WPF Animation Warning: 6: Unable to complete action

I observe in my WPF application in the VIsual Studio Output panel with the following text:

WPF animation warning: 6: the action cannot be completed because the specified Storyboard has never been applied to this object for interactive control.Action = 'Stop'; StoryBoard = 'System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode = '65981734'; Storyboard.Type = 'System.Windows.Media.Animation.Storyboard'; TargetElement = 'System.Windows.Controls.ContentPresenter'; TargetElement.HashCode = '49882372'; TargetElement.Type = 'System.Windows.Controls.ContentPresenter'

How can I “flip” a HashCode to some xaml element? How to find where this animation is attached?

Thanks in advance

+2
source share
3 answers

You can use the following code to find your StoryBoard:

private string GetStoryBoardNameByHashCode(int hashCode)
{
    foreach (DictionaryEntry resource in Resources)
    {
        if (resource.Value is Storyboard)
        {
            if (resource.GetHashCode() == hashCode)
                return ((Storyboard) resource.Value).Name;
        }
    }
    return String.Empty;
}

Run this method:

    string storyBoardName = GetStoryBoardNameByHashCode(65981734);

This should be able to get the StoryBoard-Name using a HashCode (if you want to get the specified StoryBoard, you can also return it). Keep in mind that the ResourceDictionary is here in the Window area. So, if the StoryBoards are in the ResourceDictionary of the application (App.xaml), change the "Resources" to:

Application.Current.Resources

There may be an alternative way to get all the resources of a WPF application, not just local or Application-scope, but didn't consider it. Hope this code allows you to find your problem.


Here's a sample , just in case you need it!

+5

, , .

, Begin() Stop(). , Runtime , "" .

+2

My problem was that I had a trailing space in my EventName.

<interactivity:EventTrigger EventName="SelectionChanged ">

changed to

<interactivity:EventTrigger EventName="SelectionChanged">
0
source

Source: https://habr.com/ru/post/1530326/


All Articles