views:

30

answers:

1

I have a ListBox with a DataTemplate for items. The DataTemplate contains a button. How do I rotate the UIElement represented by the DataTemplate when the button gets pressed? Any help greatly appreciated.

+1  A: 

Hi Filip,

I Guess the easiest way to implement what you need is as follows:

Edit the DataTemplate in Expression Blend, While editing the DataTemplate Create a new StoryBoard name it for example "sbItemAnim", now record your animation. then close the storyboard, you'll return to the DataTemplate Edit mode.

Now Find the Behavior called "ControlStoryboardAction" from Asset pane, Drag and Drop it over your Button.

Then Configure the Behavior to run when the Event "Clicked" is fired, and Let it control the storyboard that you've created "sbItemAnim", and Choose "Play" for the ControlStoryboardOption.

Save and test it, Hopefully it'll work with you :)

Regards,
Monir Abu Hilal
twitter: @MonirAbuHilal

Monir Abu Hilal
Somehow this sounds like a hack... But it does work =) Thank you!
Filip