Silverlight停止某些情节提要 [英] Silverlight Stop Certain Storyboards

查看:73
本文介绍了Silverlight停止某些情节提要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Silverlight控件和整个故事板.它们中的大多数都是通过鼠标输入来运行的,所以我想知道是否有一种方法可以防止在已运行情节提要的情况下运行其他情节提要.
我有:

 cWp1.Begin();
Canvas.SetZIndex(c1, 99 );
 .b1.Visibility = Visibility.Visible; < ;!-反向故事板按钮->
<!-想要阻止这些故事板 从头开始->
cWp2.Stop();
cWp1.Stop(); 



我的目标是并排放置三个画布,并使其在鼠标输入时成长和转移位置.我可以正常工作,但是如果我不小心将鼠标悬停在其他控件上,其他情节提要板就会启动并使所有内容弄乱.

解决方案

Silverlight支持多个并行运行的情节提要. br/> 最简单的方法是跟踪所有情节提要-在集合中说.
每当您要运行一个特定的故事板时,请遍历该集合并停止所有其他集合.您必须为每个画布设置OnMouseOver,以便每个情节提要板都会适当启动.现在,如果将鼠标悬停在画布1上,然后将鼠标悬停在画布2上,并且想要在运行画布2时停止画布1的情节提要,只需调用stop方法,即

 cWp2.Stop( ); 


Hi i have a silverlight control and a whole load of storyboards. Most of them run on mouse enter so i''m wondering if there''s a way i can prevent other storyboards from running when a storyboard is already being run.
I have:

cWp1.Begin();
Canvas.SetZIndex(c1, 99);
this.b1.Visibility = Visibility.Visible; <!--Reverse storyboard button -->
<!--Want to prevent these storyboards from starting-->
cWp2.Stop();
cWp1.Stop();



My aim is to have three canvases side by side and have them grow and shift location on mouse enter. I got that working but if i accidentally mouse over the other controls, other storyboards start and gets everything messed up.

解决方案

Silverlight supports multiple story boards running in parallel.
The simplest way to do this would be to do this by keeping track of all the storyboards - say in a collection.
Whenever you want to run a particular one, loop through this collection and stop all others.


Check your storyboard very well, it is possible you are starting the three storyboard at the same time. You have to set the OnMouseOver for each canvas so that each storyboard will start as appropriate. Now if you hover your mouse on canvas 1 and then on canvas 2 and you want to stop the storyboard for canvas 1 when that of canvas 2 is running, just call the stop method i.e

cWp2.Stop();


这篇关于Silverlight停止某些情节提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆