SplitOpenThemeAnimation Class

Definition

Represents the preconfigured animation that reveals a target UI using a split animation.

Equivalent WinUI class: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.

public ref class SplitOpenThemeAnimation sealed : Timeline
/// [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 SplitOpenThemeAnimation final : Timeline
/// [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 SplitOpenThemeAnimation final : Timeline
[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 SplitOpenThemeAnimation : Timeline
[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 SplitOpenThemeAnimation : Timeline
Public NotInheritable Class SplitOpenThemeAnimation
Inherits Timeline
<SplitOpenThemeAnimation .../>
Inheritance
SplitOpenThemeAnimation
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following is an example of a custom control that uses split open and split close theme animations.

// Themes/Generic.xaml
<!-- Example template of a custom control that uses split open 
     and split close theme animations. -->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BlankApp1">

    <Style TargetType="local:SplitOpenControl" >
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:SplitOpenControl">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="OpenStates">
                                <VisualState x:Name="Open">
                                    <Storyboard>
                                        <SplitOpenThemeAnimation 
                                            OpenedTargetName="contentBorder" 
                                            ContentTargetName="content" 
                                            ClosedTargetName="targetRect"
                                            ContentTranslationDirection="Left"
                                            ContentTranslationOffset="200"  
                                            OffsetFromCenter="0"
                                            OpenedLength="200"
                                            ClosedLength="0"/>
                                        <DoubleAnimation 
                                            Storyboard.TargetName="targetRect" 
                                            Storyboard.TargetProperty="Opacity" 
                                            To="0" 
                                            Duration="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Closed">
                                    <Storyboard>
                                        <SplitCloseThemeAnimation
                                            OpenedTargetName="contentBorder" 
                                            ContentTargetName="content" 
                                            ClosedTargetName="targetRect"
                                            ContentTranslationDirection="Left"
                                            ContentTranslationOffset="-200"  
                                            OffsetFromCenter="0"
                                            OpenedLength="200"
                                            ClosedLength="0"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Rectangle x:Name="targetRect" Width="100" Height="100" Fill="Blue"/>

                        <Popup IsOpen="False" Height="50" Width="200" x:Name="contentPopup">
                            <Border x:Name="contentBorder" BorderBrush="Orange" BorderThickness="3">
                                <TextBlock x:Name="content" Text="Hello, World!" FontSize="20"/>
                            </Border>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
public sealed class SplitOpenControl : Control
{
    private Popup _contentPopup;
    public SplitOpenControl()
    {
        this.DefaultStyleKey = typeof(SplitOpenControl);
    }

    protected override void OnApplyTemplate()
    {
        base.OnApplyTemplate();
        _contentPopup = GetTemplateChild("contentPopup") as Popup;
    }

    protected override void OnPointerPressed(PointerRoutedEventArgs e)
    {
        this.CapturePointer(e.Pointer);
        _contentPopup.IsOpen = true;
        VisualStateManager.GoToState(this, "Open", true);            
    }

    protected override void OnPointerReleased(PointerRoutedEventArgs e)
    {            
        VisualStateManager.GoToState(this, "Closed", true);
        this.ReleasePointerCapture(e.Pointer);
    }
}
// SplitOpenControl.h:
struct SplitOpenControl : SplitOpenControlT<SplitOpenControl>
{
    SplitOpenControl(){ DefaultStyleKey(winrt::box_value(L"MyApp.SplitOpenControl")); }

    void OnApplyTemplate();
    void OnPointerPressed(Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
    void OnPointerReleased(Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);

private:
    Windows::UI::Xaml::Controls::Primitives::Popup m_contentPopup;
};

// SplitOpenControl.cpp:
void SplitOpenControl::OnApplyTemplate()
{
    m_contentPopup = GetTemplateChild(L"contentPopup").as<Windows::UI::Xaml::Controls::Primitives::Popup>();
}

void SplitOpenControl::OnPointerPressed(Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e)
{
    CapturePointer(e.Pointer());
    m_contentPopup.IsOpen(true);
    Windows::UI::Xaml::VisualStateManager::GoToState(*this, L"Open", true);
}

void SplitOpenControl::OnPointerReleased(Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e)
{
    Windows::UI::Xaml::VisualStateManager::GoToState(*this, L"Closed", true);
    ReleasePointerCapture(e.Pointer());
}
// SplitOpenControl.h:
public ref class SplitOpenControl sealed : public Windows::UI::Xaml::Controls::Control
{
public:
    SplitOpenControl();
protected:
    virtual void OnApplyTemplate() override;
    virtual void OnPointerPressed(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
    virtual void OnPointerReleased(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
private:
    Windows::UI::Xaml::Controls::Primitives::Popup ^m_contentPopup;
};

// SplitOpenControl.cpp:
SplitOpenControl::SplitOpenControl()
{
    DefaultStyleKey = "MyApp.SplitOpenControl";
}

void SplitOpenControl::OnApplyTemplate()
{
    m_contentPopup = static_cast<Popup^>(GetTemplateChild("contentPopup"));
}

void SplitOpenControl::OnPointerPressed(PointerRoutedEventArgs^ e)
{
    CapturePointer(e->Pointer);
    m_contentPopup->IsOpen = true;
    VisualStateManager::GoToState(this, "Open", true);
}

void SplitOpenControl::OnPointerReleased(PointerRoutedEventArgs^ e)
{
    VisualStateManager::GoToState(this, "Closed", true);
    ReleasePointerCapture(e->Pointer);
}

Remarks

Note that setting the Duration property has no effect on this object since the duration is preconfigured.

Constructors

SplitOpenThemeAnimation()

Initializes a new instance of the SplitOpenThemeAnimation class.

Equivalent WinUI constructor: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.SplitOpenThemeAnimation.

Properties

AutoReverse

Gets or sets a value that indicates whether the timeline plays in reverse after it completes a forward iteration.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.Timeline.AutoReverse.

(Inherited from Timeline)
BeginTime

Gets or sets the time at which this Timeline should begin.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.Timeline.BeginTime.

(Inherited from Timeline)
ClosedLength

Gets or sets the initial size of the target element in the animation direction.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ClosedLength.

ClosedLengthProperty

Identifies the ClosedLength dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ClosedLengthProperty.

ClosedTarget

Gets or sets the UI element that specifies the initial clip size.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ClosedTarget.

ClosedTargetName

Gets or sets the identifying name of the UI element that specifies the initial clip size.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ClosedTargetName.

ClosedTargetNameProperty

Identifies the ClosedTargetName dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ClosedTargetNameProperty.

ClosedTargetProperty

Identifies the ClosedTarget dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ClosedTargetProperty.

ContentTarget

Gets or sets the UI element that will be translated. Typically this is a child/part of the element identified by OpenedTargetName or OpenedTarget.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ContentTarget.

ContentTargetName

Gets or sets the identifying name of the UI element that will be translated. Typically this is a child/part of the element identified by OpenedTargetName.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ContentTargetName.

ContentTargetNameProperty

Identifies the ContentTargetName dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ContentTargetNameProperty.

ContentTargetProperty

Identifies the ContentTarget dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ContentTargetProperty.

ContentTranslationDirection

Gets or sets a value that determines which direction the content should translate when the animation runs.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ContentTranslationDirection.

ContentTranslationDirectionProperty

Identifies the ContentTranslationDirection dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ContentTranslationDirectionProperty.

ContentTranslationOffset

Gets or sets the pixels to translate by when the animation runs.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ContentTranslationOffset.

ContentTranslationOffsetProperty

Identifies the ContentTranslationOffset dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.ContentTranslationOffsetProperty.

Dispatcher

Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.

Equivalent WinUI property: Microsoft.UI.Xaml.DependencyObject.Dispatcher.

(Inherited from DependencyObject)
Duration

Gets or sets the length of time for which this timeline plays, not counting repetitions.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.Timeline.Duration.

(Inherited from Timeline)
FillBehavior

Gets or sets a value that specifies how the animation behaves after it reaches the end of its active period.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.Timeline.FillBehavior.

(Inherited from Timeline)
OffsetFromCenter

Gets or sets an offset from the center of the opened target.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.OffsetFromCenter.

OffsetFromCenterProperty

Identifies the OffsetFromCenter dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.OffsetFromCenterProperty.

OpenedLength

Gets or sets the final size of the target UI element.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.OpenedLength.

OpenedLengthProperty

Identifies the OpenedLength dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.OpenedLengthProperty.

OpenedTarget

Gets or sets the UI element that will be clipped.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.OpenedTarget.

OpenedTargetName

Gets or sets the identifying name of the UI element that will be clipped.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.OpenedTargetName.

OpenedTargetNameProperty

Identifies the OpenedTargetName dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.OpenedTargetNameProperty.

OpenedTargetProperty

Identifies the OpenedTarget dependency property.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.SplitOpenThemeAnimation.OpenedTargetProperty.

RepeatBehavior

Gets or sets the repeating behavior of this timeline.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.Timeline.RepeatBehavior.

(Inherited from Timeline)
SpeedRatio

Gets or sets the rate, relative to its parent, at which time progresses for this Timeline.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.Timeline.SpeedRatio.

(Inherited from Timeline)

Methods

ClearValue(DependencyProperty)

Clears the local value of a dependency property.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.ClearValue.

(Inherited from DependencyObject)
GetAnimationBaseValue(DependencyProperty)

Returns any base value established for a dependency property, which would apply in cases where an animation is not active.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.GetAnimationBaseValue.

(Inherited from DependencyObject)
GetValue(DependencyProperty)

Returns the current effective value of a dependency property from a DependencyObject.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.GetValue.

(Inherited from DependencyObject)
ReadLocalValue(DependencyProperty)

Returns the local value of a dependency property, if a local value is set.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.ReadLocalValue.

(Inherited from DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.RegisterPropertyChangedCallback.

(Inherited from DependencyObject)
SetValue(DependencyProperty, Object)

Sets the local value of a dependency property on a DependencyObject.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.SetValue.

(Inherited from DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback.

Equivalent WinUI method: Microsoft.UI.Xaml.DependencyObject.UnregisterPropertyChangedCallback.

(Inherited from DependencyObject)

Events

Completed

Occurs when the Storyboard object has completed playing.

Equivalent WinUI event: Microsoft.UI.Xaml.Media.Animation.Timeline.Completed.

(Inherited from Timeline)

Applies to

See also