TiltEffect and LongListSelector

前端 未结 6 1307
遇见更好的自我
遇见更好的自我 2021-02-19 07:26

I am trying to use the TiltEffect from the Silverlight toolkit within a LongListSelector. This is how the element is declared in XAML:

         


        
6条回答
  •  广开言路
    2021-02-19 07:53

    The way TiltEffect works is that is contains a list of Types that it will tilt, by deafult these are Button and ListBoxItem. It then drills down through the visual tree from where you turn it on and adds the effect to all instances of those classes. So your LongListSelector.ItemTemplate needs to contain a tiltable item. The easiest way to do this is with an invisible button, that way you do not need to edit your TiltEffect and can use it straight out of the toolkit. If you really don't want the button, then you need some other ContentControl to wrap your template from which you can trigger the tilting. Then add that class to the TiltEffect list.

    TiltEffect.TiltableItems.Add(typeof(MyTiltingContentControl))
    

    I use this style on my button to make it invisible.

    
    

提交回复
热议问题