共用方式為


HOW TO:建立光暈效果動畫

更新:2007 年 11 月

本主題說明如何建立 OuterGlowBitmapEffectGlowSize 屬性的動畫。

範例

在下列範例中,會建立 OuterGlowBitmapEffectGlowSize 屬性變更的動畫。結果是,當 TextBox 取得焦點時,光暈會向外建立動畫。

<Page xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" >

  <StackPanel>


    <TextBox Width="200">
      <TextBox.BitmapEffect>

        <!-- This BitmapEffect is targeted by the animation. -->
        <OuterGlowBitmapEffect x:Name="myOuterGlowBitmapEffect"  
         GlowColor="Blue" GlowSize="0" />

      </TextBox.BitmapEffect>
      <TextBox.Triggers>
        <EventTrigger RoutedEvent="TextBox.GotFocus">
          <BeginStoryboard>
            <Storyboard>

              <!-- Animate the GlowSize from 0 to 40 over half a second. --> 
              <DoubleAnimation
                Storyboard.TargetName="myOuterGlowBitmapEffect"
                Storyboard.TargetProperty="GlowSize"
                From="0" To="40" Duration="0:0:0.5" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </TextBox.Triggers>
    </TextBox>

  </StackPanel>

</Page>

如需完整範例,請參閱點陣圖效果圖庫範例

請參閱

工作

HOW TO:在物件的外部邊緣上建立光暈效果

HOW TO:建立柔邊視覺效果動畫

HOW TO:建立下拉式陰影視覺效果的動畫

HOW TO:建立多個視覺效果的動畫

點陣圖效果圖庫範例

概念

點陣圖效果概觀

參考

GlowSize

OuterGlowBitmapEffect

TextBox

其他資源

點陣圖效果 HOW TO 主題

點陣圖效果範例