ContentThemeTransition 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供控制項內容變更時的動畫轉換行為。 除了 AddDeleteThemeTransition之外,也可能套用此專案。
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.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ContentThemeTransition 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 ContentThemeTransition 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 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.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ContentThemeTransition : Transition
Public NotInheritable Class ContentThemeTransition
Inherits Transition
<ContentThemeTransition ... />
- 繼承
- 屬性
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
範例
下列範例會將 ContentThemeAnimation 套用至矩形。
<!-- 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;
}
備註
請注意,設定 Duration 屬性不會影響此物件,因為預先設定持續時間。
建構函式
ContentThemeTransition() |
初始化 ContentThemeTransition 類別的新實例。 |
屬性
Dispatcher |
取得與此物件相關聯的 CoreDispatcher 。 CoreDispatcher代表可以存取 UI 執行緒上DependencyObject的功能,即使程式碼是由非 UI 執行緒起始也一樣。 (繼承來源 DependencyObject) |
HorizontalOffset |
取得或設定在轉換使用中時,目標在水準方向轉譯的距離。 |
HorizontalOffsetProperty |
識別 HorizontalOffset 相依性屬性。 |
VerticalOffset |
取得或設定在轉換使用中時,目標在垂直方向轉譯的距離。 |
VerticalOffsetProperty |
識別 VerticalOffset 相依性屬性。 |
方法
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) |