locked
how do i programmatically access and trigger an animation in a UserControlf used as a DataTemplate in a Listbox RRS feed

  • Question

  • I have a user control that exposes a storybord, scalex & scaley render transforms for a usercontrol and I'm using this usercontrol as a datatemplate for a listbox.

      <ItemsControl x:Name="list">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <local:MyControl />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
    How do I Iterate through the items in list, how do i get the reference to the instance of MyControl associated with the item in the itemcontrol?

    Thursday, April 8, 2010 4:54 PM

Answers

  • Here is an example of how you can get to the visuals (MyControl types) for the items in a listbox/itemscontrol:

    http://social.expression.microsoft.com/Forums/en-US/blend/thread/f7dc1c01-4eee-4d7a-84f5-0c3234ae2801

     

    To iterate through them, just do foreach(var item in this.list.ItemsSource).

    Thursday, April 8, 2010 7:26 PM
    Moderator

All replies

  • Here is an example of how you can get to the visuals (MyControl types) for the items in a listbox/itemscontrol:

    http://social.expression.microsoft.com/Forums/en-US/blend/thread/f7dc1c01-4eee-4d7a-84f5-0c3234ae2801

     

    To iterate through them, just do foreach(var item in this.list.ItemsSource).

    Thursday, April 8, 2010 7:26 PM
    Moderator
  • Thanks Chuck! Very helpful! :)
    Friday, April 9, 2010 12:47 AM
  • Thanks Chuck! Very helpful! :)
    Friday, April 9, 2010 12:48 AM