共用方式為


EntranceThemeTransition 類別

定義

提供控制項第一次出現時的動畫轉換行為。 您可以在個別物件或物件的容器上使用此功能。 在後者的情況下,子項目會依序動畫顯示檢視,而不是同時顯示所有專案。

public ref class EntranceThemeTransition sealed : Transition
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class EntranceThemeTransition final : Transition
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class EntranceThemeTransition final : Transition
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class EntranceThemeTransition : Transition
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class EntranceThemeTransition : Transition
Public NotInheritable Class EntranceThemeTransition
Inherits Transition
<EntranceThemeTransition .../>
繼承
Object Platform::Object IInspectable DependencyObject Transition EntranceThemeTransition
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

此範例示範如何將 EntranceThemeTransition 套用至 Button

<Button Content="EntranceThemeTransition Button">
    <Button.Transitions>
        <TransitionCollection>
            
            <!-- This transition just uses the default behavior which is to
                 have the button animate into view from the right. You can
                 make it start from anywhere on the right by using the
                 FromHorizontalOffset property. If you'd rather see a vertical
                 animation, use the FromVerticalOffset property. -->
            <EntranceThemeTransition />
        </TransitionCollection>
    </Button.Transitions>
</Button>

在這裡,會使用 Style 資源來套用 EntranceThemeTransition。

<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
    <Grid.Resources>
        <Style x:Key="DefaultButtonStyle" TargetType="Button">
            <Setter Property="Transitions">
                <Setter.Value>
                    <TransitionCollection>
                        <EntranceThemeTransition/>
                    </TransitionCollection>
                </Setter.Value>
            </Setter>
        </Style>
    </Grid.Resources>

    <Button Style="{StaticResource DefaultButtonStyle}" 
            Content="EntranceThemeTransition style applied" />

</Grid>

如果您在面板上設定 EntranceThemeTransition 動畫,當面板的子系在檢視中產生動畫時,會自動位移,以建立視覺吸引人的入口。

在這裡,當矩形新增至 StackPanel 時,它們會從右上方飛入,而不只是就地顯示。

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Button Content="Add rectangle" Click="Button_Click"/>

    <StackPanel x:Name="panel1" HorizontalAlignment="Left" Margin="200">
        <StackPanel.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition 
                FromHorizontalOffset="200" 
                FromVerticalOffset="-200"/>
            </TransitionCollection>
        </StackPanel.ChildrenTransitions>
    </StackPanel>
</Grid>
private void Button_Click(object sender, RoutedEventArgs e)
{
    // Add a rectangle to the StackPanel.
    Rectangle r = new Rectangle();
    r.Width = 100;
    r.Height = 100;

    // Alternate colors as rectangles are added.
    if (panel1.Children.Count % 2 == 0)
    {
        r.Fill = new SolidColorBrush(Colors.Green);
    }
    else
    {
        r.Fill = new SolidColorBrush(Colors.Yellow);
    }
    panel1.Children.Add(r);
}

建構函式

EntranceThemeTransition()

初始化 EntranceThemeTransition 類別的新實例。

屬性

Dispatcher

取得這個 物件相關聯的 CoreDispatcherCoreDispatcher代表可在 UI 執行緒上存取DependencyObject的功能,即使程式碼是由非 UI 執行緒起始也一樣。

(繼承來源 DependencyObject)
FromHorizontalOffset

取得或設定動畫使用中時,目標轉譯為水準方向的距離。

FromHorizontalOffsetProperty

識別 FromHorizontalOffset 相依性屬性。

FromVerticalOffset

取得或設定動畫使用中時,目標會以垂直方向轉譯的距離。

FromVerticalOffsetProperty

識別 FromVerticalOffset 相依性屬性。

IsStaggeringEnabled

取得或設定值,這個值會決定轉換過時轉譯多個專案,或一次轉譯所有專案。

IsStaggeringEnabledProperty

識別 IsStaggeringEnabled 相依性屬性。

方法

ClearValue(DependencyProperty)

清除相依性屬性的本機值。

(繼承來源 DependencyObject)
GetAnimationBaseValue(DependencyProperty)

傳回為相依性屬性建立的任何基底值,如果動畫未使用中,則適用此屬性。

(繼承來源 DependencyObject)
GetValue(DependencyProperty)

DependencyObject傳回相依性屬性的目前有效值。

(繼承來源 DependencyObject)
ReadLocalValue(DependencyProperty)

如果已設定本機值,則傳回相依性屬性的本機值。

(繼承來源 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

註冊通知函式,以接聽此DependencyObject實例上特定DependencyProperty的變更。

(繼承來源 DependencyObject)
SetValue(DependencyProperty, Object)

設定 DependencyObject上相依性屬性的本機值。

(繼承來源 DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消先前透過呼叫 RegisterPropertyChangedCallback註冊的變更通知。

(繼承來源 DependencyObject)

適用於

另請參閱