【问题标题】:Start template animation as soon as control is loaded加载控件后立即启动模板动画
【发布时间】:2011-10-28 07:21:04
【问题描述】:

我的ControlTemplate 中有以下代码:

<EventTrigger RoutedEvent="ControlTemplate.Loaded">
            <EventTrigger.EnterActions>
                <BeginStoryboard>

我想在加载控件时启动我在 ControlTemplate 中定义的 Storyboard。所以我的问题是:ControlTemplate 中的什么会引发 Loaded 事件?

我不能使用 FrameworkElement.Loaded 作为我的动画目标的对象,当 Loaded 事件被触发时无法访问。

附: ControlTemplate.Loaded 不工作

【问题讨论】:

    标签: wpf templates animation storyboard


    【解决方案1】:

    ControlTemplate 类没有 Loaded 事件。尝试只使用LoadedXXX.Loaded,其中XXX 是您正在模板化的控件类型的名称,而不是ControlTemplate

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      • 2016-05-24
      • 1970-01-01
      • 2016-07-22
      • 1970-01-01
      相关资源
      最近更新 更多