tags:

views:

400

answers:

0

Hi friends,

Is there a way to bind To / From property of a DoubleAnimation inside a storyboard to an element inside the CotrolTemplate in XAML markup?

Something like this:

<ControlTemplate TargetType="{x:Type Expander}">
    <DockPanel>
        <ContentPresenter x:Name="ExpandSite" Height="140"   DockPanel.Dock="Bottom"/>
    </DockPanel>
    <ControlTemplate.Resources>
        <Storyboard x:Key="StoryboardExpanded">
            <DoubleAnimation From="0" To="{Binding ElementName=ExpandSite, Path=Height}" Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="Height" Duration="0:00:00.2"/>
       </Storyboard>
    </ControlTemplate.Resources>
    <ControlTemplate.Triggers>
        <Trigger Property="IsExpanded" Value="true">
             <Trigger.ExitActions>
                  <BeginStoryboard Storyboard="{StaticResource StoryboardCollapsed}" x:Name="StoryboardCollapsed_BeginStoryboard"/>
             </Trigger.ExitActions>
             <Trigger.EnterActions>
                 <BeginStoryboard Storyboard="{StaticResource StoryboardExpanded}" x:Name="StoryboardExpanded_BeginStoryboard"/>
             </Trigger.EnterActions>
             <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
         </Trigger>
    </ControlTemplate.Triggers>
</ControlTemplate>

To="{Binding ElementName=ExpandSite, Path=Height}"

Thanks.