Animate width from right to left

wpf, wpf-animation, xaml

Solution

In your codebehind,

public DockWindow()
    {
        InitializeComponent();
        this.Left = this.Width + SystemParameters.FullPrimaryScreenWidth;
    }

Change your trigger to

<Window.Triggers>
    <EventTrigger RoutedEvent="Window.Loaded">
        <BeginStoryboard>
            <Storyboard >
                <DoubleAnimation Duration="0:0:1.5" Storyboard.TargetProperty="Left"  To="10" AccelerationRatio=".1"/>
            </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</Window.Triggers>

Problem

I want to animate my window coming in from the right edge of the screen. This is my xaml ``` <Window x:Class="SidebarTest.DockWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="DockWindow" Width="275" ShowInTaskbar="False" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True" Background="Transparent" > <Window.Triggers> <EventTrigger RoutedEvent="Window.Loaded"> <BeginStoryboard> <Storyboard > <DoubleAnimation Duration="0:0:1.5" Storyboard.TargetProperty="Width" From="0" To="275" AccelerationRatio=".1"/> </Storyboard> </BeginStoryboard> </EventTrigger> </Window.Triggers> <Grid Background="#2F2F2F"> </Grid> ``` But it animates the width from left to right instead of right to left. Like this: How can I change this so it comes in from the edge?

Original source