locked
Cannot change z-order for usercontrol in storyboard RRS feed

  • Question

  • This is my first post here!  :)

    Here's what I am trying to accomplish in a WPF Sketchflow project:

    1.  make a usercontrol fade into view when the user clicks a button on the main dialog
    2.  make the dialog fade away when the user clicks a button on the usercontrol

    Here's what I did:
    1.  created dialog with a button, as well as other elements that have storyboards that animate when they are rolled over
    2.  created a usercontrol with some buttons on it, and positioned it over the main dialog, and set the Z order to -1 and opacity to 0.
    3.  added an event to the button that changes the usercontrol's z-order to 1 and opacity to 100.

    This totally works as expected -- all of my storyboards work when elements on the main dialog get rolled over, and the button makes my usercontrol appear.

    Here's where I had trouble -- making the usercontrol disappear .  I figured that I could simply add a button event to the close button on the usercontrol that sets the z-order to -1 again, and the opacity to 0.  Unfortunately, I cannot change the z-order to -1, presumably because I'm editing the usercontrol file, and there's only 1 level of Z.  The obvious effect is that once I close the usercontrol, it fades away, but is still above the elements on my main dialog, thus the storyboards no longer work because the mouseover events don't get fired...

    Is there a better way to approach this?  I thought that I could easily cheat by moving the usercontrol off of the screen after the opacity is set to 0, but then realized that's also impossible.  :)
    Thursday, November 12, 2009 3:51 PM

All replies

  • Instead of setting Opacity to 0, Set Visiblity=Hidden. That way you dont have to set the ZOrder property at all.
    Wednesday, December 16, 2009 11:56 PM