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
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.