简体   繁体   中英

In an WinRT / Universal app how do I check for a change in the image source

How do I create an if statement which checks the image source. Here is my code:

public void WhoWon()
{
    if (UserPick.Source ="ms-appx:Assets/RPS3.png")
    {
    }      
}

The error says

cannot implicitly convert from string to wundows.ui.blahblah.media.change..

Two questions:

  1. How do I fix this exception?

  2. How do I do check if the imagesource changed?

  1. You should be able to know when the image source has changed by subscribing to the Image.ImageOpened Event .

  2. Comparing for equality takes two equal signs, not one which assigns a value

    if (UserPick.Source == "ms-appx:Assets/RPS3.png")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM