开发者

Bind to storyboard defined inside a UserControl from the parent window

I just got my storyboard working, now I'm trying to encapsulate all of the functionality into a UserControl.

The goal is to take a button on my window, and have it start a storyboard (that slides the user control into view) that is defined within my UserControl, then when a button within the UserControl is clicked t开发者_StackOverflow中文版rigger yet another storyboard in the user control (to slide the the UserControl out.)

I found this question, which seems quite similar; however, there's no satisfactory answer there and additionally, I'm open to other solutions to achieve my goal.

My assumption is that my UserControl should know how to "slide" itself into view and out of view, this control is basically a glorified input dialog so it will be told to "show" it self externally, but only it will know when it hide itself.

I would be OK with the animation/storyboarding being defined outside the control, but if that is best (which seems to be the consensus from the question above) -- how would I "slide-out" when the OK or Cancel button is pushed from within the control?

It feels ugly for the Window to perform the "slide-in" and the control to perform "slide-out" -- but that is where the originating control exists.

I'd rather a fully XAML solution; but I'm open to dropping some code in the UserControl. I'm looking for a robust and easy solution, because once I get this working, I have several additional UserControls to fit into this mold.


May be you should try Visual States?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜