Question

I'm new to Windows Phone and writing an application that uses LongListSelector with group to display data. What I can't implement is, I'm trying to change LongListSelector's ItemTemplate from code by selecting an item of LLS. I tried lots of things but I think they're all for loading, I cannot change an item's template.

What should I use to change an item's template of LLS by selecting it?

Was it helpful?

Solution

Sorry for the late reply, I must have missed a notification.

So, my second suggestion still won't work. It's only for static templates, meaning once your Items DataTemplate is loaded, there's no way to change them.

What you can do though, is have the XAML of your normal and selected templates in a style and tweek their visibility based on VisualState. I've edited the sample disklosr posted to illustrate what I mean, notice how the StoryBoard of the CustomUserControl changes the visibility of the NormalGrid and SelectedGrid. You can have any layout you wish inside those two grid's bound to your dataItems.

Sample

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top