ContentThemeTransition Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Fournit le comportement de transition animé pour le moment où le contenu d’un contrôle change. Cela peut être appliqué en plus de AddDeleteThemeTransition.
public ref class ContentThemeTransition sealed : Transition
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ContentThemeTransition final : Transition
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ContentThemeTransition : Transition
Public NotInheritable Class ContentThemeTransition
Inherits Transition
<ContentThemeTransition ... />
- Héritage
- Attributs
Exemples
L’exemple suivant applique une ContentThemeAnimation à un 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;
}
Remarques
Notez que la définition de la propriété Duration n’a aucun effet sur cet objet, car la durée est préconfigurée.
Constructeurs
| Nom | Description |
|---|---|
| ContentThemeTransition() |
Initialise une nouvelle instance de la classe ContentThemeTransition . |
Propriétés
| Nom | Description |
|---|---|
| Dispatcher |
Retourne |
| DispatcherQueue |
Obtient le |
| HorizontalOffset |
Obtient ou définit la distance par laquelle la cible est traduite dans la direction horizontale lorsque la transition est active. |
| HorizontalOffsetProperty |
Identifie la propriété de dépendance HorizontalOffset . |
| VerticalOffset |
Obtient ou définit la distance par laquelle la cible est traduite dans la direction verticale lorsque la transition est active. |
| VerticalOffsetProperty |
Identifie la propriété de dépendance VerticalOffset . |
Méthodes
| Nom | Description |
|---|---|
| ClearValue(DependencyProperty) |
Efface la valeur locale d’une propriété de dépendance. (Hérité de DependencyObject) |
| GetAnimationBaseValue(DependencyProperty) |
Retourne toute valeur de base établie pour une propriété de dépendance, qui s’applique dans les cas où une animation n’est pas active. (Hérité de DependencyObject) |
| GetValue(DependencyProperty) |
Retourne la valeur effective actuelle d’une propriété de dépendance à partir d’un DependencyObject. (Hérité de DependencyObject) |
| ReadLocalValue(DependencyProperty) |
Retourne la valeur locale d’une propriété de dépendance, si une valeur locale est définie. (Hérité de DependencyObject) |
| RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback) |
Inscrit une fonction de notification pour écouter les modifications apportées à une dependencyProperty spécifique sur cette instance DependencyObject . (Hérité de DependencyObject) |
| SetValue(DependencyProperty, Object) |
Définit la valeur locale d’une propriété de dépendance sur un DependencyObject. (Hérité de DependencyObject) |
| UnregisterPropertyChangedCallback(DependencyProperty, Int64) |
Annule une notification de modification qui a été précédemment inscrite en appelant RegisterPropertyChangedCallback. (Hérité de DependencyObject) |