国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

第15章 動畫基礎(2)——故事板、觸發器

2019-11-10 18:48:41
字體:
來源:轉載
供稿:網友

一、故事板

①故事板是增強型的時間線,可用來分組多個動畫,而且具有動畫播放的能力(暫停、停止以及改變播放位置)。

②一個故事面板中可以放置多個動畫,并且每個動畫可用于不同的元素和屬性。

③故事面板的定義如下:

<Storyboard>    <DoubleAnimation         Storyboard.TargetName="cmdGrow"         Storyboard.TargetPRoperty="Width"        To="250"         Duration="0:0:5">    </DoubleAnimation></Storyboard>二、何處定義觸發器可以在以下4個位置定義觸發器:

在樣式中(Styles.Triggers)在控件模版中(ControlTemplate.Triggers)在數據模版中(DataTemplate.Triggers)直接在元素中定義事件觸發器(FrameworkElement.Triggers),僅支持事件觸發器。三、直接在元素中定義事件觸發器觸發器實例

<Button Padding="10" Name="cmdGrow" Height="40" Width="160"        HorizontalAlignment="Center" VerticalAlignment="Center">    <Button.Triggers>        <EventTrigger>            <BeginStoryboard>                <Storyboard>                    <DoubleAnimation                         Storyboard.TargetProperty="Width"                        To="250"                         Duration="0:0:5">                    </DoubleAnimation>                </Storyboard>            </BeginStoryboard>        </EventTrigger>    </Button.Triggers>    <Button.Content>        Click and Make Me Grow    </Button.Content></Button>四、在樣式中定義觸發器實例

<Window x:Class="Animation.AnimationInStyle"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        Title="AnimationInStyle" Height="300" Width="300"    >    <Window.Resources>        <Style x:Key="GrowButtonStyle">            <Style.Triggers>                <Trigger Property="Button.IsPressed" Value="True">                    <Trigger.EnterActions>                        <BeginStoryboard>                            <Storyboard>                                <DoubleAnimation                                     Storyboard.TargetName="cmdGrow"                                     Storyboard.TargetProperty="Width"                                    To="250"                                     Duration="0:0:5">                                </DoubleAnimation>                            </Storyboard>                        </BeginStoryboard>                    </Trigger.EnterActions>                </Trigger>            </Style.Triggers>        </Style>    </Window.Resources>    <Button Padding="10" Name="cmdGrow" Height="40" Width="160" Style="{StaticResource GrowButtonStyle}"            HorizontalAlignment="Center" VerticalAlignment="Center">            Click and Make Me Grow        </Button></Window>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 东阳市| 左贡县| 卓资县| 万安县| 漳浦县| 高雄市| 湖北省| 赣榆县| 唐河县| 马龙县| 井陉县| 镇沅| 千阳县| 郯城县| 华容县| 蒙阴县| 乌苏市| 黔江区| 富阳市| 会东县| 山东省| 中西区| 泌阳县| 洛浦县| 临颍县| 维西| 海城市| 绥德县| 亳州市| 洛宁县| 崇阳县| 聊城市| 长沙县| 沂南县| 吴堡县| 保康县| 榆林市| 菏泽市| 宁津县| 安吉县| 漳州市|