2

I have a WPF project and in which the Application Icon is taken from a specific path using a converter and please find the sample code block.

MainWindow.xaml.cs

Icon="{Binding Converter={StaticResource IconToImageConverter}}"

Converter class:

public class IconToImageConverter : IValueConverter
{
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return new BitmapImage(new Uri(TheIconPath)); 
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
}

We can replace the icon any time in the specific path and it will be reflected in the Taskbar while we run the application next time from the bin folder or Visual studio.

We have an installer for this application which creates the Desktop shortcut Icon for the application. Now it seems like the taskbar icon is only taken from the Desktop shortcut icon and it never changes based on the Icon placed on the specific path.

My requirement is that I need the icon to be referred from the specific path as it behaved on the bin or visual studio.

Venkat
  • 2,549
  • 2
  • 28
  • 61
  • 1
    Your observation is likely to be a result of icon being cached. You can theoretically [clear cache](https://stackoverflow.com/q/3243317/1997232), but I think recreating shortcut should work too. – Sinatr Jan 24 '19 at 13:42

0 Answers0