You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @KannanKrish,
apologies for my late response - this library has not been my number one priority recently.
I tried to look at this issue and did some simple tests. I am not 100% certain, but I think that your behaviors are trying to execute the animations too early. I think that following is happening. When the animation is started, the GetAnimationManager() method is called. This method tries to access MauiContext through view's handler which is not created yet.
Could you please try to move the first execution of the animation into a Loaded callback? When the Loaded event is raised, MauiContext is accessible and GetAnimationManager() should not throw an exception.
public class MyBehavior : Behavior<View>
{
protected override void OnAttachedTo(View bindable)
{
bindable.Loaded += static (sender, e) =>
{
if (sender is not View loadedBindable)
return;
// View is loaded and MauiContext should be accessible. Do the work with loadedBindable...
};
// MauiContext is not accessible yet...
base.OnAttachedTo(bindable);
}
// Other code...
}
My xaml markup code is (code have the behavior)
IsVisibleAnimBehavior behavior is responsible for triggering the animation whenever the visibility changes.
When app runs, I got exception like
The behavior works fine with normal Content Page.
The text was updated successfully, but these errors were encountered: