I try to implement a ListBox where the selected item is displayed in more detail than the others. One approach is shown by Josh Smith on his blog.
To enhance the user experience, I’d like to animate the change (i.e. the item growing larger, additional information fading in).
Using the DataTriggers Enter- or ExitActions to start Storyboard has the disadvandates, that
- I have no reusable template for the detailed view (it just exists as the end state of an animation).
- Every change to the detailed view hs to be worked in at the two animations instead of just once.
Is there another approach thats more easily maintainable?
You could use this
ListBox.ItemContainerStyleand adjust it for your needs.In this case I have declared the templates as resources.
But I think binding datatemplated content directly to
ContentPresenter.Contentis possible too.If Details are additional and not for replacement of Compact, simply remove all
DoubleAnimationfromStoryboardwithStoryboard.TargetName="Compact".Hope this helps.