wpfimagetelerikiconsradwindow

WPF: put an icon on a radWindow programatically


I want to put an icon on the top left of a radWindow programatically

my code is like this

    RadWindow radWindow = new RadWindow();
radWindow.Header = "The header";
radWindow.Icon = new Image()
   {
   Source = new BitmapImage(new Uri("../ressources/enregistrer.png", UriKind.Relative))
   };
radWindow.Show();

but the icon dont show up

does anyone have an idea ?

EDIT

This is the architecture on my project: The file from where the above code is taken is circled in red The ressource file is circled in green

enter image description here


Solution

  • I dont know why my solution above did not work but I found a workaround like this

    RadWindow radWindow = new RadWindow();
    radWindow.Header = "The header";
    radWindow.Icon = new Image()
    {
                        Source = new BitmapImage(new Uri("pack://application:,,,/ressources/enregistrer.png", UriKind.RelativeOrAbsolute))
        }
     radWindow.Show();