Image customization. Source from resource file

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?

+3
source share
1 answer

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

+6
source

Source: https://habr.com/ru/post/1730538/


All Articles