Igor Kulman
Igor Kulman

Reputation: 16361

Disabling tilt effect for some items in ListView on Windows Phone

I have a Windows Phone 8.1 app showing a list of items in a ListView. I set IsItemClickEnabled to True.

There are two types of items in the ListView, "active" and "disabled" ones. Both type render differently, I use a ItemTemplateSelector to choose the right template.

I want the "active" items to be clickable with the standard tilt effect (pressed animation) and the "disabled" items not to generate the tilt effect (I do not care about the click being fired, I can handle that).

I found out I can disable the tilt effect on a ListView as a whole editing the ItemContainerStyle template. But how can I disable it only for some items in the ListView?

Upvotes: 2

Views: 262

Answers (2)

Igor Kulman
Igor Kulman

Reputation: 16361

The solutions is to use a ItemContainerStyleSelector:

  • define a custom StyleSelector with two style and the logic to switch between those two style

  • use it as a ItemContainerStyleSelector on the ListView

  • make sure you remove any explicit ItemContainerStyle from the ListView. If you define one, it will be taken as superior style, not a default style and the StyleSelector will not work.

Upvotes: 1

Mato Peto
Mato Peto

Reputation: 96

You can disable tilt in ItemContainerStyle, and enable tilt for individual item template... by e.g. custom control with tilt effect.

Upvotes: 0

Related Questions