FrameworkContentElement.BeginStoryboard 方法
定义
开始所提供的演示图板中包含的操作序列。Begins the sequence of actions that are contained in the provided storyboard.
重载
BeginStoryboard(Storyboard) |
开始所提供的演示图板中包含的操作序列。Begins the sequence of actions that are contained in the provided storyboard. |
BeginStoryboard(Storyboard, HandoffBehavior) |
开始所提供的演示图板中包含的操作序列,其中指定了在该属性经过动画处理后要发生的行为的选项。Begins the sequence of actions that are contained in the provided storyboard, with options specified for what should occur if the property is already animated. |
BeginStoryboard(Storyboard, HandoffBehavior, Boolean) |
开始所提供的演示图板中包含的操作序列,其中指定了在动画开始之后动画控件的状态。Begins the sequence of actions that are contained in the provided storyboard, with specified state for control of the animation after it is started. |
BeginStoryboard(Storyboard)
开始所提供的演示图板中包含的操作序列。Begins the sequence of actions that are contained in the provided storyboard.
public:
void BeginStoryboard(System::Windows::Media::Animation::Storyboard ^ storyboard);
public void BeginStoryboard (System.Windows.Media.Animation.Storyboard storyboard);
member this.BeginStoryboard : System.Windows.Media.Animation.Storyboard -> unit
Public Sub BeginStoryboard (storyboard As Storyboard)
参数
- storyboard
- Storyboard
要开始的演示图板。The storyboard to begin.
注解
对于不使用 isControllable
、参数或指定了该参数的签名 false
,与动画关联的时间线时钟一旦到达 "填充" 时间段就会被删除。For the signatures that do not use the isControllable
, parameter, or when that parameter is specified false
, the timeline clocks associated with the animation are removed as soon as it reaches the "Fill" period. 因此,在运行一次后无法重新启动动画。Therefore the animation cannot be restarted after being run once. 请注意,控制动画还要求情节提要作为代码中的实例进行命名或访问。Note that controlling an animation also requires that the storyboard be named or accessible as an instance in code.
适用于
BeginStoryboard(Storyboard, HandoffBehavior)
开始所提供的演示图板中包含的操作序列,其中指定了在该属性经过动画处理后要发生的行为的选项。Begins the sequence of actions that are contained in the provided storyboard, with options specified for what should occur if the property is already animated.
public:
void BeginStoryboard(System::Windows::Media::Animation::Storyboard ^ storyboard, System::Windows::Media::Animation::HandoffBehavior handoffBehavior);
public void BeginStoryboard (System.Windows.Media.Animation.Storyboard storyboard, System.Windows.Media.Animation.HandoffBehavior handoffBehavior);
member this.BeginStoryboard : System.Windows.Media.Animation.Storyboard * System.Windows.Media.Animation.HandoffBehavior -> unit
Public Sub BeginStoryboard (storyboard As Storyboard, handoffBehavior As HandoffBehavior)
参数
- storyboard
- Storyboard
要开始的演示图板。The storyboard to begin.
- handoffBehavior
- HandoffBehavior
一个枚举值,该值描述演示图板中描述的属性在经过动画处理后要使用的行为。A value of the enumeration that describes behavior to use if a property described in the storyboard is already animated.
注解
对于不使用 isControllable
、参数或指定了该参数的签名 false
,与动画关联的时间线时钟一旦到达 "填充" 时间段就会被删除。For the signatures that do not use the isControllable
, parameter, or when that parameter is specified false
, the timeline clocks associated with the animation are removed as soon as it reaches the "Fill" period. 因此,在运行一次后无法重新启动动画。Therefore the animation cannot be restarted after being run once. 请注意,控制动画还要求情节提要作为代码中的实例进行命名或访问。Note that controlling an animation also requires that the storyboard be named or accessible as an instance in code.
使用撰写 HandoffBehaviorUsing the Compose HandoffBehavior
Storyboard使用将、或应用 AnimationTimeline AnimationClock 到属性时 Compose HandoffBehavior , Clock 以前与该属性关联的任何对象将继续使用系统资源; 计时系统不会自动删除时钟。When you apply a Storyboard, AnimationTimeline, or AnimationClock to a property by using the Compose HandoffBehavior, any Clock objects previously associated with that property continue to consume system resources; the timing system does not remove the clocks automatically.
若要避免在使用应用大量时钟时出现性能问题 Compose ,应在完成后从动画属性中删除组合时钟。To avoid performance issues when you apply a large number of clocks by using Compose, you should remove composing clocks from the animated property after they complete. 有几种方法可以删除时钟:There are several ways to remove a clock:
若要从属性中删除所有时钟,请 ApplyAnimationClock(DependencyProperty, AnimationClock) 使用 BeginAnimation(DependencyProperty, AnimationTimeline) 动画对象的或方法。To remove all clocks from a property, use the ApplyAnimationClock(DependencyProperty, AnimationClock) or BeginAnimation(DependencyProperty, AnimationTimeline) method of the animated object. 将要进行动画处理的属性指定为第一个参数,并将指定
null
为第二个参数。Specify the property being animated as the first parameter, andnull
as the second. 这将从属性中移除所有动画时钟。This removes all animation clocks from the property.若要从时钟列表中删除特定的 AnimationClock ,请使用 Controller 的属性 AnimationClock 来检索 ClockController ,然后调用的 Remove 方法 ClockController 。To remove a specific AnimationClock from a list of clocks, use the Controller property of the AnimationClock to retrieve a ClockController, then call the Remove method of the ClockController. 通常在 Completed 时钟的事件处理程序中完成此操作。This is typically done in the Completed event handler for a clock. 请注意,只能通过控制根时钟, ClockController Controller 子时钟的属性返回
null
。Note that only root clocks can be controlled by a ClockController; the Controller property of a child clock returnsnull
. 另请注意, Completed 如果时钟的有效持续时间是永久性的,则不会引发事件。Note also that the Completed event is not raised if the effective duration of the clock is forever. 在这种情况下,用户必须确定何时调用 Remove 。In that case, the user must determine when to call Remove.
此动画问题主要出现在生存期较长的对象上。This is primarily an issue for animations on objects that have a long lifetime. 当对对象进行垃圾回收时,还会断开其时钟的连接并对其进行垃圾回收。When an object is garbage collected, its clocks are also disconnected and garbage collected.
有关时钟对象的详细信息,请参阅 动画和计时系统概述。For more information about clock objects, see Animation and Timing System Overview.
适用于
BeginStoryboard(Storyboard, HandoffBehavior, Boolean)
开始所提供的演示图板中包含的操作序列,其中指定了在动画开始之后动画控件的状态。Begins the sequence of actions that are contained in the provided storyboard, with specified state for control of the animation after it is started.
public:
void BeginStoryboard(System::Windows::Media::Animation::Storyboard ^ storyboard, System::Windows::Media::Animation::HandoffBehavior handoffBehavior, bool isControllable);
public void BeginStoryboard (System.Windows.Media.Animation.Storyboard storyboard, System.Windows.Media.Animation.HandoffBehavior handoffBehavior, bool isControllable);
member this.BeginStoryboard : System.Windows.Media.Animation.Storyboard * System.Windows.Media.Animation.HandoffBehavior * bool -> unit
Public Sub BeginStoryboard (storyboard As Storyboard, handoffBehavior As HandoffBehavior, isControllable As Boolean)
参数
- storyboard
- Storyboard
要开始的演示图板。The storyboard to begin.
- handoffBehavior
- HandoffBehavior
一个枚举值,该值描述演示图板中描述的属性在经过动画处理后要使用的行为。A value of the enumeration that describes behavior to use if a property described in the storyboard is already animated.
- isControllable
- Boolean
声明在动画开始后是否仍可以对它进行控制(可以暂停)。Declares whether the animation is controllable (can be paused) after it is started.
注解
对于不使用 isControllable
、参数或指定了该参数的签名 false
,与动画关联的时间线时钟一旦到达 "填充" 时间段就会被删除。For the signatures that do not use the isControllable
, parameter, or when that parameter is specified false
, the timeline clocks associated with the animation are removed as soon as it reaches the "Fill" period. 因此,在运行一次后无法重新启动动画。Therefore the animation cannot be restarted after being run once. 请注意,控制动画还要求情节提要作为代码中的实例进行命名或访问。Note that controlling an animation also requires that the storyboard be named or accessible as an instance in code.
使用撰写 HandoffBehaviorUsing the Compose HandoffBehavior
Storyboard使用将、或应用 AnimationTimeline AnimationClock 到属性时 Compose HandoffBehavior , Clock 以前与该属性关联的任何对象将继续使用系统资源; 计时系统不会自动删除这些时钟。When you apply a Storyboard, AnimationTimeline, or AnimationClock to a property by using the Compose HandoffBehavior, any Clock objects previously associated with that property continue to consume system resources; the timing system does not remove these clocks automatically.
若要避免在使用应用大量时钟时出现性能问题 Compose ,应在完成后从动画属性中删除组合时钟。To avoid performance issues when you apply a large number of clocks by using Compose, you should remove composing clocks from the animated property after they complete. 有几种方法可以删除时钟:There are several ways to remove a clock:
若要从属性中删除所有时钟,请 ApplyAnimationClock(DependencyProperty, AnimationClock) 使用 BeginAnimation(DependencyProperty, AnimationTimeline) 动画对象的或方法。To remove all clocks from a property, use the ApplyAnimationClock(DependencyProperty, AnimationClock) or BeginAnimation(DependencyProperty, AnimationTimeline) method of the animated object. 将要进行动画处理的属性指定为第一个参数,并将指定
null
为第二个参数。Specify the property being animated as the first parameter, andnull
as the second. 这将从属性中移除所有动画时钟。This removes all animation clocks from the property.若要从时钟列表中删除特定的 AnimationClock ,请使用 Controller 的属性 AnimationClock 来检索 ClockController ,然后调用的 Remove 方法 ClockController 。To remove a specific AnimationClock from a list of clocks, use the Controller property of the AnimationClock to retrieve a ClockController, then call the Remove method of the ClockController. 通常在 Completed 时钟的事件处理程序中完成此操作。This is typically done in the Completed event handler for a clock. 请注意,只能通过控制根时钟, ClockController Controller 子时钟的属性返回
null
。Note that only root clocks can be controlled by a ClockController; the Controller property of a child clock returnsnull
. 另请注意, Completed 如果时钟的有效持续时间是永久性的,则不会引发事件。Note also that the Completed event is not raised if the effective duration of the clock is forever. 在这种情况下,用户必须确定何时调用 Remove 。In that case, the user must determine when to call Remove.
此动画问题主要出现在生存期较长的对象上。This is primarily an issue for animations on objects that have a long lifetime. 当对对象进行垃圾回收时,还会断开其时钟的连接并对其进行垃圾回收。When an object is garbage collected, its clocks are also disconnected and garbage collected.
有关时钟对象的详细信息,请参阅 动画和计时系统概述。For more information about clock objects, see Animation and Timing System Overview.