views:

23

answers:

0

I'd like to bind the z index of list box items to their index.

Ideally, we would have

Style TargetType='{x:Type ListBoxItem}'>

Setter Property='Panel.ZIndex' Value='{Binding RelativeSource={RelativeSource Self}, Path=-Index} />

...

However, the list box item does not have an index property.

I can think of a number of crazy solutions but nothing simple and elegant.

Any taker?