Is it possible to change a ListBox' ItemTemplate from a Storyboard?
I have a behavior that changes the visual state based on the page's orientation (portrait/landscape). I have a ListBox with a somewhat complex DataTemplate for its ItemTemplate. Is it possible to change the ItemTemplate from a VisualState's Storyboard? My XAML karma is low, and Blend doesn't let me do it (it changes the ori开发者_开发问答ginal ItemTemplate, it doesn't add a storyboard entry).
And remember, this is for Windows Phone 7 (thus Silverlight 3).
I probably didn't get an answer because it was too obvious. I told you my XAML karma was low. Here is the solution. Simply add this ObjectAnimationUsingKeyFrames to your storyboard:
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(ItemsControl.ItemTemplate)"
Storyboard.TargetName="PartakersListBox">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{StaticResource LandscapePartakerDataTemplate}" />
</ObjectAnimationUsingKeyFrames>
I didn't return to Blend yet, to see if the template was editable. Will update below.
精彩评论