Giridhaar 0 Newbie Poster

I have been following this tutorial (http://www.codeproject.com/Articles/18379/WPF-Tutorial-Part-Writing-a-custom-animation-cla) to try and adjust the Width of one of my Grids upon a Button click.

<Grid Grid.Row="2">

        <Grid.ColumnDefinitions>
            <ColumnDefinition Name="leftGrid"  Width="7*"/>
            <ColumnDefinition Name="rightGrid" Width="3*"/>                
        </Grid.ColumnDefinitions>

        <i:Interaction.Triggers>
            <ei:PropertyChangedTrigger Binding="{Binding State}">
                <ei:GoToStateAction StateName="{Binding State}" />
            </ei:PropertyChangedTrigger>
        </i:Interaction.Triggers>


        <VisualStateManager.VisualStateGroups >
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualState x:Name="Expanded">
                    <Storyboard>
                    <local:GridLengthAnimation
                                    Storyboard.Target="{Binding ElementName=rightGrid}"
                                    Storyboard.TargetProperty="Width"
                                    Duration="0:0:1" To="3*"/>
                    </Storyboard>                       
                </VisualState>
                <VisualState x:Name="Contracted">
                    <Storyboard>
                    <local:GridLengthAnimation
                                    Storyboard.Target="{Binding ElementName=rightGrid}"
                                    Storyboard.TargetProperty="Width"
                                    Duration="0:0:1" To="0*"/>
                    </Storyboard>                                             
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

GridLengthAnimation

public class GridLengthAnimation : AnimationTimeline
{

    public static readonly DependencyProperty ToProperty =
    DependencyProperty.Register(
        "To", typeof(GridLength), typeof(GridLengthAnimation));

    public GridLength To
    {
        get { return (GridLength)GetValue(GridLengthAnimation.ToProperty); }
        set { SetValue(GridLengthAnimation.ToProperty, value); }
    }

    public override Type TargetPropertyType
    {
        get { return typeof(GridLength); }
    }

    protected override Freezable CreateInstanceCore()
    {
        return new GridLengthAnimation();
    }

    public override object GetCurrentValue(
        object defaultOriginValue, object defaultDestinationValue,
        AnimationClock animationClock)
    {
        var from = (GridLength)defaultOriginValue;

        if (from.GridUnitType != To.GridUnitType ||
            !animationClock.CurrentProgress.HasValue)
        {
            return from;
        }

        var p = animationClock.CurrentProgress.Value;

        Console.WriteLine("To Value = " + To.Value);

        return new GridLength(
            (1d - p) * from.Value + p * To.Value,
            GridUnitType.Star);
    }
}

The moment I click a Button and change the value of State, I get the above error.

I don't understand why I'm getting the error because GridLengthAnimation returns a value of GridLength not Double. As stated in the link I provided, isn't this what is required for Row/Column Definitions?

Could someone please tell me what the issue may be?