VisualBrush Animation

Is it possibile to associate an animation inside a Visual Brush

Is there any sample proving it

Thanks

gio



Answer this question

VisualBrush Animation

  • paulo.jorge.carvalho

    Here is a sample.

    Thanks!
    Ed Maia
    WPF PM

    <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <Button Width="320" Height="240">
    <Button.Background>
    <VisualBrush>
    <VisualBrush.Visual>
    <Canvas>
    <Rectangle Width="320" Height="240" Name="myRect" Fill="Blue">
    <Rectangle.Triggers>
    <EventTrigger RoutedEvent="FrameworkElement.Loaded">
    <EventTrigger.Actions>
    <BeginStoryboard>
    <BeginStoryboard.Storyboard>
    <Storyboard >
    <ColorAnimation To="Red" Duration="0:0:2" Storyboard.TargetName="myRect" Storyboard.TargetProperty="Fill.Color" AutoReverse="True" RepeatBehavior="Forever"/>
    </Storyboard>
    </BeginStoryboard.Storyboard>
    </BeginStoryboard>
    </EventTrigger.Actions>
    </EventTrigger>
    </Rectangle.Triggers>
    </Rectangle>
    </Canvas>
    </VisualBrush.Visual>
    </VisualBrush>
    </Button.Background>
    </Button>
    </Canvas>


  • cwr1

    Generally, you can simply pop open .NET reflector and check if any given class derives from Animatible (or implements IAnimatible).

    If it does then you can animate any of it's DependencyProperties.

  • VisualBrush Animation