Udostępnij za pośrednictwem


Panel.BackgroundTransition Property

Definition

Gets or sets an instance of BrushTransition to automatically animate changes to the Background property.

BrushTransition BackgroundTransition();

void BackgroundTransition(BrushTransition value);
public BrushTransition BackgroundTransition { get; set; }
var brushTransition = panel.backgroundTransition;
panel.backgroundTransition = brushTransition;
Public Property BackgroundTransition As BrushTransition

Property Value

An instance of BrushTransition to automatically animate changes to the Background; otherwise, null. The default is null.

Windows requirements

Device family
Windows 10, version 1809 (introduced in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v7.0)

Examples

This example shows how to apply a background transition to a Grid. Each time GridBackground is updated, the background will animate from the old brush to the new brush.

<Grid Background="{x:Bind GridBackground}">
    <Grid.BackgroundTransition>
        <BrushTransition />
    </Grid.BackgroundTransition>
</Grid>

Remarks

Use this property to animate any change to the Background property. When a new value is set from code or through data binding, the change is animated from the old value to the new value, rather than happening instantaneously.

Even though the transition animation takes time, the change to the actual property value is instantaneous. For example, if you change a property from code and then read it back, you’ll see the new value, even though the visual effect of the property change is somewhere between the new and the old.

If a property value changes a second time while the first change is still animating, the animation will use the currently animated value as the "starting" value for the next animation, and then animate to the new "final" value. The duration will be reset.

Applies to

See also