6
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?

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Sergio Tapia
  • 40,006
  • 76
  • 183
  • 254

1 Answers1

7

set source to new BitmapImage(new Uri("C:\Users\Sergio\Documents\Visual Studio 2008\Projects\emailwpf\emailwpf\ok.png")) You can set in XAML to string value, because registered converter is used under the hood;

Yuriy Zanichkovskyy
  • 1,689
  • 11
  • 16