Alternative to Triggers on WP8

前端 未结 2 1195
陌清茗
陌清茗 2021-01-21 05:41

I\'ve read that Triggers are not supported in XAML for WP8. What\'s the alternative approach? I wanted to use a trigger to change the background image of a button w

2条回答
  •  花落未央
    2021-01-21 06:35

    You could, potentially just attach an event handler for the "Tap" event for the image. Without code examples, I'm not too sure how much I can help; however, I've pasted some code below:

    XAML

                    
    

    Code Behind (C#)

    private void AwesomeImg_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
          YourImageName.ImageSource = //code here to URI of image
        }
    

    Hope this helps!

提交回复
热议问题