ContentThemeTransition ContentThemeTransition ContentThemeTransition Class

Provides the animated transition behavior for when the content of a control is changing. This might be applied in addition to AddDeleteThemeTransition.

Syntax

Declaration

public sealed class ContentThemeTransitionpublic sealed class ContentThemeTransitionPublic NotInheritable Class ContentThemeTransition
<ContentThemeTransition ... />

Inheritance Hierarchy

Remarks

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

Examples

The following example applies a ContentThemeTransition to a rectangle.


<!-- The ContentThemeTransition will execute when the ContentControl’s content changes. -->        
<ContentControl x:Name="ContentHost" PointerPressed="ContentHost_PointerPressed">
    <ContentControl.ContentTransitions>
        <TransitionCollection>
            <ContentThemeTransition/>
        </TransitionCollection>
    </ContentControl.ContentTransitions>
    <Rectangle Height="200" Width="200" Fill="Orange"/>
</ContentControl>
private void ContentHost_PointerPressed(object sender, PointerRoutedEventArgs e)
{
    // Replace the ContentControl's content with a new Rectangle of a random color.
    Rectangle newItem = new Rectangle();
    Random rand = new Random();

    newItem.Height = 200;
    newItem.Width = 200;
    newItem.Fill = new SolidColorBrush(Color.FromArgb(255, 
         (byte)rand.Next(0, 255), (byte)rand.Next(0,255), (byte)rand.Next(0, 255)));

    ContentHost.Content = newItem; 
}
void MyPage::ContentHost_PointerPressed(Object^ sender, PointerRoutedEventArgs^ e)
{
    // Replace the ContentControl's content with a new Rectangle of a random color.
    Rectangle^ newItem = ref new Rectangle();

    newItem->Height = 200;
    newItem->Width = 200;

    Color color;
    color.R = rand() % 256;
    color.G = rand() % 256;
    color.B = rand() % 256;

    newItem->Fill = ref new SolidColorBrush(color);

    ContentHost->Content = newItem; 
}

Constructors summary

Initializes a new instance of the ContentThemeTransition class.

Properties summary

Gets or sets the distance by which the target is translated in the horizontal direction when the transition is active.

Identifies the HorizontalOffset dependency property.

Gets or sets the distance by which the target is translated in the vertical direction when the transition is active.

Identifies the VerticalOffset dependency property.

Constructors

  • ContentThemeTransition()
    ContentThemeTransition()
    ContentThemeTransition()
    ContentThemeTransition()

    Initializes a new instance of the ContentThemeTransition class.

    public ContentThemeTransition()public New()Public Sub New()public ContentThemeTransition()

Properties

  • HorizontalOffset
    HorizontalOffset
    HorizontalOffset
    HorizontalOffset

    Gets or sets the distance by which the target is translated in the horizontal direction when the transition is active.

    public double HorizontalOffset { get; set; }public double HorizontalOffset { get; set; }Public ReadWrite Property HorizontalOffset As doublepublic double HorizontalOffset { get; set; }
    <ContentThemeTransition HorizontalOffset="double" />
    

    Property Value

    • double
      double
      double

      The horizontal offset translation, in pixels.

  • HorizontalOffsetProperty
    HorizontalOffsetProperty
    HorizontalOffsetProperty
    HorizontalOffsetProperty

    Identifies the HorizontalOffset dependency property.

    public static DependencyProperty HorizontalOffsetProperty { get; }public static DependencyProperty HorizontalOffsetProperty { get; }Public Static ReadOnly Property HorizontalOffsetProperty As DependencyPropertypublic static DependencyProperty HorizontalOffsetProperty { get; }

    Property Value

  • VerticalOffset
    VerticalOffset
    VerticalOffset
    VerticalOffset

    Gets or sets the distance by which the target is translated in the vertical direction when the transition is active.

    public double VerticalOffset { get; set; }public double VerticalOffset { get; set; }Public ReadWrite Property VerticalOffset As doublepublic double VerticalOffset { get; set; }
    <ContentThemeTransition VerticalOffset="double" />
    

    Property Value

    • double
      double
      double

      The vertical offset translation, in pixels.

  • VerticalOffsetProperty
    VerticalOffsetProperty
    VerticalOffsetProperty
    VerticalOffsetProperty

    Identifies the VerticalOffset dependency property.

    public static DependencyProperty VerticalOffsetProperty { get; }public static DependencyProperty VerticalOffsetProperty { get; }Public Static ReadOnly Property VerticalOffsetProperty As DependencyPropertypublic static DependencyProperty VerticalOffsetProperty { get; }

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.Media.Animation.dll