0

I try to begin a storyboard and I want that it modifies two properties in parallel.

My code:

<Window x:Class="WpfWindowEffects.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Name="MyMainWindow" Height="0" Width="0" WindowStyle="ToolWindow">
<Window.Triggers>
    <EventTrigger RoutedEvent="Window.Loaded">
        <BeginStoryboard>
            <Storyboard>
                <DoubleAnimation AutoReverse="True" RepeatBehavior="Forever" Storyboard.TargetName="MyMainWindow" Storyboard.TargetProperty="Width" Duration="0:0:1" To="600" />
                <DoubleAnimation AutoReverse="True" RepeatBehavior="Forever" Storyboard.TargetName="MyMainWindow" Storyboard.TargetProperty="Height" To="600" Duration="0:0:1" />
            </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</Window.Triggers>
<Grid>

</Grid>

But it doesn't work in parallel... I want to open a window with size 0,0 and resize it to 600x600. Do you know another way to achieve it?

UPDATE

I implemented that and it works. I don't know if there is a better way to achieve that.

<Window x:Class="WpfWindowEffects.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Name="MyMainWindow" WindowStyle="None" SizeToContent="WidthAndHeight" AllowsTransparency="True" Background="Transparent">
<DockPanel Height="10" Width="10" Name="MyGrid" HorizontalAlignment="Left" VerticalAlignment="Top" Background="CornflowerBlue">
    <DockPanel.Triggers>
        <EventTrigger RoutedEvent="Window.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="MyGrid" Storyboard.TargetProperty="Width" Duration="0:0:5" To="600" />
                    <DoubleAnimation Storyboard.TargetName="MyGrid" Storyboard.TargetProperty="Height" To="600" Duration="0:0:5" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </DockPanel.Triggers>
    <TextBlock Name="notificationTitle" Padding="5" FontSize="14" Foreground="White">
        Call Manager - Incoming Call
    </TextBlock>

    <Path Name="closeButton"  Grid.Column="1" Margin="5,10,10,0" Fill="White" Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z " />
</DockPanel>

MrScf
  • 2,407
  • 5
  • 27
  • 40
  • 1
    See if this link helps: http://stackoverflow.com/questions/12332385/animating-a-wpf-window-width-and-height – Vinkal Feb 12 '15 at 17:36
  • I read this post but and it's very tricky. I thought,maybe there is a solution by using xaml code – MrScf Feb 12 '15 at 17:40

0 Answers0