Storyboard in HierarchicalDataTemplate RRS feed

  • Question

  • Hi,

    I have a TreeView control that I bound to an XML file.  I did the binding manually (drag+drop) once I defined the data source in the data tab.  I've been editing the HierarchicalDataTemplate that was created to tweak the binding the way I want, but I can't seem to figure out how to plug-in a storyboard. 


    In my HDT, I've created a stackpanel that has a button that I want to appear after every item in the TreeView.  That part works fine, and I've even wired up the eventhandler for the button ok.  But, I'd like to animate that button when it's clicked.  How do I animate that button?  Right now I have the following in my XAML (yeah, I know...it's a mess) and it doesn't seem to work:


    <sdk:HierarchicalDataTemplate x:Key="categoryTemplate" ItemsSource="{Binding categoryCollection}">
    			<StackPanel Orientation="Horizontal">
    			<Storyboard x:Name="myStoryboard">
    			<DoubleAnimation Storyboard.TargetName="MyTranslation" Storyboard.TargetProperty="TranslateX" From="0" To="400" Duration="0:0:1" AutoReverse="True" RepeatBehavior="Forever" /> 
    			<DoubleAnimation Storyboard.TargetName="MyTranslation" Storyboard.TargetProperty="TranslateY" From="0" To="25" Duration="0:0:1" AutoReverse="True" RepeatBehavior="Forever" /> 
    				<TextBlock Text="{Binding name}"/>
    					<Button Click="AddLayer" x:Name="Btn" Height="20" Width="20" Margin="0,0,5,0"
    					HorizontalContentAlignment="Left" Padding="2" HorizontalAlignment="Right d:LayoutOverrides="Width"
    					Tag="{Binding url}" RenderTransformOrigin="0.5,0.5" >
    							<CompositeTransform x:Name="MyTranslation" TranslateX="0" TranslateY="0"/>
    					<Image x:Name="Geoimg" Source="Images/addmt3px.png" Margin="2" />

    and in the XAML.cs "AddLayer" function I havethe line:


    but it doesn't seem to kick off the storyboard.

    Any Thoughts?


    Tuesday, June 8, 2010 2:30 PM