0

I have a simple question. Can Visual states be defined through code for a button in WP8? We can change visual states through code using GoTo function but can visual states be defined in the code behind?

Suppose on the click of a button I need to change the image of it? Is there any method by which you can change the background through visual states.

alfah
  • 2,077
  • 1
  • 31
  • 55
  • Yes you can create a VisualState for a control You should add the VisualStateGroup into the VisualStateGroupManager.VisualStateGroups attached property of the Control. – Balraj Singh Feb 21 '14 at 06:13
  • 1
    It's unusual to do that at runtime though. Why not just create a button control that sets the background directly? – WiredPrairie Feb 21 '14 at 12:02

0 Answers0