none
Find element inside rectangle.

    Question

  • Here is some XAML

    <Rectangle Name="rec" Fill="White" Stroke="#FF000000" Width="90" Height="15" RadiusX="4" RadiusY="4">

     

    <Rectangle.Resources>

    <Storyboard Name="rectangleStoryboard" Storyboard.TargetName="animatingGradientStop" Storyboard.TargetProperty="Color" >

    <ColorAnimation From="Black" To="White" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever" />

    </Storyboard>

    <Storyboard Name="StoryBoardTop" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Canvas.Top)">

    <DoubleAnimation Name="animationTop" Duration ="0:0:1" />

    </Storyboard>

    So I would like to find

    sender.FindName("animationTop")

    but without having to use "animationTop"

    I would like to get the sotryboard element from the sender without using the name since I'm going to have multiple of these and i don't want to reference by name.

    My other option would be to have duplicate Names. From what I read this is possible by associateing a chunk of objects with namescopes by using the followinng control.Content.CreateFromXaml and passing True for the second parameter. But how can i accomplish this without having to use the method CreatFromXaml?

     

    Thank you

    Thursday, December 06, 2007 12:45 PM

All replies

  • Perhaps it can help you: http://msdn2.microsoft.com/en-us/library/bb875980.aspx This is the complete information link: http://msdn2.microsoft.com/en-us/library/bb188568.aspx
    Friday, December 07, 2007 9:26 AM
  • If you know the sequence of the DoubleAnimation in storyboard then you can call them without name property

    In your case,

    StoryBoardTop.Children(0)

    Friday, December 07, 2007 10:20 AM
  • Ok when canvas is clicked I'm able to get to the rectangle inside canvas by sender.children.GetItem(0) that's no problem. But how do I get to the property elements usind index not name?

    I don't think StoryBoardTop.Children(0) is even valid.

     

    Friday, December 07, 2007 10:40 AM