0

I use the Tilt Effect provided by Microsoft

I want a generic way to change the background when an element is touched. The tilt effect uses FrameworkElement since all Control inherit from it. But if I want to change the background of any element, I need to access the Background property...

Do you think there is a way for me to modify the sample so I can add this behavior ?

edit : if it's not possible by modifying the Tilt Effect code how could I write something generic enough so I don't have to change the Visual State of every element

Thomas Joulin
  • 6,590
  • 9
  • 53
  • 88

2 Answers2

0

The Tilt Effect has nothing to do with it. You need to change the Visual State od the button - an example.

Community
  • 1
  • 1
Lukasz Madon
  • 14,664
  • 14
  • 64
  • 108
  • alright. i edited my question. I want something "like" the tilt effect : one single class that defines the behavior of all controls touched. Thanks for pointing out that I was unclear. Do you think there is a way to change the Visual State of every element ? – Thomas Joulin Jan 07 '11 at 17:00
0

If you use Jeff Wilcox's TiltContentControl as your base class, you can use Themes\generic.xaml to define the default style and the VisualStateManager to define a Pressed and a Normal state (the DepressAndTilt method would be where you switch to the Pressed state and the TiltUpCompleted method would be where you revert to the Normal state). Your default style would wrap the ContentPresenter with a Border, whose Background you update in the Pressed state.

Derek Lakin
  • 16,179
  • 36
  • 51