github编辑

TransitioningContentControl

The TransitioningContentControl is a ContentControl which can render PageTransitions when the Content changes.

Common Properties

Property
Description

Content

Gets or sets the content to display in the control

ContentTemplate

Gets or sets the DataTemplatearrow-up-right used to display the content

PageTransition

Gets or sets the PageTransitionarrow-up-right which will be shown when the content changes

Reference

TransitioningContentControlarrow-up-right

Source code

TransitioningContentControl.csarrow-up-right

Example

Let's assume we have a collection of different images and we want to show them in a slideshow like view. In order to do this we can setup our TransitioningContentControl like this:

<TransitioningContentControl Content="{Binding SelectedImage}" >
    <TransitioningContentControl.ContentTemplate>
        <DataTemplate DataType="Bitmap">
            <Image Source="{Binding}" />
        </DataTemplate>
    </TransitioningContentControl.ContentTemplate>
</TransitioningContentControl>
TransitioningContentControl Example

Changing the PageTransition

If you don't like the PageTransition which is provided by the applied theme, you can also provide your own PageTransitionarrow-up-right. This can be done in XAML, provided via Binding or via DynamicResource.

In the sample below we will change the PageTransitionarrow-up-right to slide the images horizontally.

TransitioningContentControl Example

Disable the PageTransition

If you want to disable the transition, set the PageTransition to null.

最后更新于