private void SetCredentials()
{
username = txtfromEmail.Text;
password = txtpassword.Text;
pictureLogin.Source = @"C:\Users\Sergio\Documents\Visual Studio 2008\Projects\emailwpf\emailwpf\ok.png";
}
I get an error: "Cannot convert string to ImageSource"
.
What can I do?
将source设置为new BitmapImage(new Uri("C:\\Users\\Sergio\\Documents\\Visual Studio 2008\\Projects\\emailwpf\\emailwpf\\ok.png"))
你可以在XAML中设置字符串值,因为注册的转换器是在引擎盖;
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.