ContentThemeTransition Class
Definition
Provides the animated transition behavior for when the content of a control is changing. This might be applied in addition to AddDeleteThemeTransition.
Equivalent WinUI class: Microsoft.UI.Xaml.Media.Animation.ContentThemeTransition.
public ref class ContentThemeTransition 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.Static(Windows.UI.Xaml.Media.Animation.IContentThemeTransitionStatics, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class ContentThemeTransition sealed : 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.WebHostHidden]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Media.Animation.IContentThemeTransitionStatics, 65536, "Windows.Foundation.UniversalApiContract")]
class ContentThemeTransition sealed : 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.Static(typeof(Windows.UI.Xaml.Media.Animation.IContentThemeTransitionStatics), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class ContentThemeTransition : 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.WebHostHidden]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Media.Animation.IContentThemeTransitionStatics), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ContentThemeTransition : Transition
Public NotInheritable Class ContentThemeTransition
Inherits Transition
<ContentThemeTransition ... />
- Inheritance
- Attributes
Windows 10 requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Examples
The following example applies a ContentThemeAnimation 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 ContentHost_PointerPressed(Windows::Foundation::IInspectable const& /* sender */,
Windows::UI::Xaml::Input::PointerRoutedEventArgs const& /* e */)
{
// Replace the ContentControl's content with a new Rectangle of a random color.
Windows::UI::Xaml::Shapes::Rectangle newItem;
newItem.Height(200);
newItem.Width(200);
Windows::UI::Color color;
color.R = std::rand() % 256;
color.G = std::rand() % 256;
color.B = std::rand() % 256;
newItem.Fill(Windows::UI::Xaml::Media::SolidColorBrush{ color });
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;
}
Remarks
Note that setting the Duration property has no effect on this object since the duration is preconfigured.
Constructors
ContentThemeTransition() |
Initializes a new instance of the ContentThemeTransition class. Equivalent WinUI constructor: Microsoft.UI.Xaml.Media.Animation.ContentThemeTransition.ContentThemeTransition. |
Properties
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) |
HorizontalOffset |
Gets or sets the distance by which the target is translated in the horizontal direction when the transition is active. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.ContentThemeTransition.HorizontalOffset. |
HorizontalOffsetProperty |
Identifies the HorizontalOffset dependency property. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.ContentThemeTransition.HorizontalOffsetProperty. |
VerticalOffset |
Gets or sets the distance by which the target is translated in the vertical direction when the transition is active. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.ContentThemeTransition.VerticalOffset. |
VerticalOffsetProperty |
Identifies the VerticalOffset dependency property. Equivalent WinUI property: Microsoft.UI.Xaml.Media.Animation.ContentThemeTransition.VerticalOffsetProperty. |