[英]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. 如何创建一个if语句来检查图像源。 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..
无法从字符串隐式转换为wundows.ui.blahblah.media.change ..
Two questions: 两个问题:
How do I fix this exception? 如何解决此异常?
How do I do check if the imagesource changed? 如何检查图像源是否已更改?
You should be able to know when the image source has changed by subscribing to the Image.ImageOpened Event . 通过订阅Image.ImageOpened Event,您应该能够知道何时更改了图像源。
Comparing for equality takes two equal signs, not one which assigns a value 比较是否相等需要两个等号,而不是分配一个值的一个
if (UserPick.Source == "ms-appx:Assets/RPS3.png")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.