I have a simple application. When you press the button, the tasbar icon changes. When I run this application from visual studio, everything works fine, but when I publish the WPF application, the taskbar icon does not work (it isn’t).
The build action is set to "built-in resource / copy always", I also tested "Resource", but it does not work.
var iconUri = new Uri("pack://application:,,,/images/internet_connection.ico", UriKind.RelativeOrAbsolute);
this.Icon = BitmapFrame.Create(iconUri);
the icon in the upper left corner of the frame changes, but there is no taskbar.
Can anybody help me?
@Edit,
I got it to work thanks to @Pavel's comment. But now one problem remains:
When I run it in visual studio and I do this:
var iconUri = UriHelper.GetUri(this.GetType(), "images/local_network.ico");
this.Icon = BitmapFrame.Create(iconUri);
The icon is changing. But with the published version, it does not change.
@@ Edit
Ok, so this is my code when I click the button:
var iconUri = UriHelper.GetUri(this.GetType(), "images/internet_connection.ico");
this.Icon = BitmapFrame.Create(iconUri);
mNotifyIcon = new NotifyIcon
{
BalloonTipText = "The app has been minimised. Click the tray icon to show.",
BalloonTipTitle = "The App",
Text = "The App",
Icon = BitmapFrame.Create(iconUri)
};
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = UriHelper.GetUri(this.GetType(), "images/internet_connection.png");
image.EndInit();
TaskbarItemInfo = new System.Windows.Shell.TaskbarItemInfo() { Overlay = image };
:
VS: , , .
exe: , , .
- ?