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".
"Cannot convert string to ImageSource"
What can I do?
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;
new BitmapImage(new Uri("C:\Users\Sergio\Documents\Visual Studio 2008\Projects\emailwpf\emailwpf\ok.png"))
Source: https://habr.com/ru/post/1730538/More articles:What css hacks for IE 6 and 7 are future proofs? - cssDoes using AJAX use PHP memory usage? - javascriptкак объект List List добавляет прилагаемую строку - c#How to adjust the position of a JButton if the JFrame matrix is resized? - javaLisp Function Chain Macro - macrosАппаратные точки останова на XP 64 бит - debugginghow to show arab warning from left to right - javascriptDead end in single-threaded application - multithreadingRewriting the IIS 7 URL does not work if it has a question mark in the question - url-rewritingC ++ class scope - c ++All Articles