Share via


Border.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 = border.backgroundTransition;
border.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.

Examples

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

<Border Background="{x:Bind BorderBackground}">
    <Border.BackgroundTransition>
        <BrushTransition />
    </Border.BackgroundTransition>
</Border>

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