locked
Animating popup display

    Question

  • I'm using a simple storyboard to fade in the display of a dynamically created popup. The storyboard target is the popup, and the code is:

    popup -> IsOpen = true;

    Storyboard^ storyboard = dynamic_cast<Storyboard^>(Resources -> Lookup("fadeIn"));
    storyboard->Begin();

    This works, but since it's not clear to me how much the popup and the storyboard know about each other, I was wondering if there was any situation in which the popup might display before the story board starts. For example, does it depend on a UI cycle time with the popup waiting to open at the start of the next cycle, and if the storyboard starts in the same cycle the fade in will happen, otherwise not?  

    Thursday, December 6, 2012 9:19 PM

Answers

All replies

  • Hello,

     

     I will involve more experts to investigate it.

     

    Best regards,

    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, December 10, 2012 8:23 AM
  • Hi,

    Please take a look at this article explaining UI thread and composition/animation thread: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994638.aspx

    So it will not have mismatch timing as long the component already added in the UI.

    But for Popup control, to make sure it already showed on UI then you can put storyboard->Begin() inside Popup.Opened event: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.primitives.popup.opened


    Regards,
    Christian HL
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by RobertHF Tuesday, December 11, 2012 12:48 PM
    Tuesday, December 11, 2012 8:36 AM
  • Thanks,

    I'll try the Popup::Opened approach.

    Another possibility that occurred to me was that since I'm animating the opacity to do the fade in, I could set the popup's opacity to 0 before calling Popup::Open(). Then, even if the popup is open before the animation starts, it shouldn't matter.

    Tuesday, December 11, 2012 12:48 PM