I am creating a WPF window and loading a user control inside like below:
Uri uri = new Uri(\"Views/ApplicationInfo.xaml\", UriKind.RelativeOrAbsolute);
versionWindow.Icon = BitmapFrame.Create(new Uri("pack://application:,,,/YourProjectName;component/Images/computer.ico", UriKind.RelativeOrAbsolute))
Assume I have a project with a folder named Assets and inside a have a png image with build action Resource or Embedded resource.
Then this works:
var versionWindow = new Window
{
Height = 250,
Width = 400,
ResizeMode = ResizeMode.NoResize,
Icon = new BitmapImage(new Uri(@"pack://application:,,,/Assets/icon.png"))
};
versionWindow.Show();