简体   繁体   English

如何用过渡替换Silverlight / WP7中的当前控件?

[英]How to replace current control in Silverlight/WP7 with a transition?

I have a Wp7 that has two controls. 我有一个具有两个控件的Wp7。 One is a map, and the other is a panorama control. 一个是地图,另一个是全景控件。 In one of the panorama items is a list of values. 全景项目之一是值列表。 If a user clicks on a list item, I'd like to show a turnstile transition to a new control that shows more detail. 如果用户单击列表项,我想显示一个旋转门过渡到显示更多详细信息的新控件。

So far in XAML, I have an event bound to LeftMouseUp, and it triggers. 到目前为止,在XAML中,我有一个绑定到LeftMouseUp的事件,它会触发。 However I'm now sure how to replace the current panoramaitem with a new control (view), or how to use a the TurnstileTransition provided by the silverlight toolkit, between the two. 但是,我现在确定如何在新控件(视图)中替换当前的Panoramaitem,或者如何在两者之间使用silverlight工具包提供的TurnstileTransition。

TurnstileTransition transitionElement = 
  new TurnstileTransition { Mode = TurnstileTransitionMode.ForwardIn };

AlertDetailedView view = new AlertDetailedView();

view.DataContext = (e.OriginalSource as FrameworkElement).DataContext;

//this stuff below sorta doesnt really work...
ITransition transition = transitionElement.GetTransition(this);

transition.Completed += delegate
{
   transition.Stop();

};
transition.Begin();

In order to fit in with WP7 Navigation (eg the Back Button) then I'd recommend that you use two different pages for the two controls. 为了适合WP7导航(例如“后退”按钮),我建议您对两个控件使用两个不同的页面。

For seeing how to animate page transitions, then the SL toolkit contains some helpful material - or Kevin Marshall's blog is also very helpful - eg http://blogs.claritycon.com/kevinmarshall/2010/05/12/windows-phone-7-prototype-002-animated-page-transitions-writeable-bitmaps/ 若要查看如何为页面过渡设置动画,则SL工具包包含一些有用的材料-或Kevin Marshall的博客也非常有帮助-例如http://blogs.claritycon.com/kevinmarshall/2010/05/12/windows-phone-7原型002动画页面过渡可写位图/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM