0
votes

I am making a WPF application following MVVM pattern. In application i am displaying some icons. Here is my code.

XAML

<Image Margin="2" Source="{Binding Icon1}" Height="16px" Width="16px" />
<Image Margin="2" Source="{Binding Icon2}" Height="16px" Width="16px" />
<Image Margin="2" Source="{Binding Icon3}" Height="16px" Width="16px" />

And here is ViewModel.

public string Icon1 { get { return @"C:\MyIcons\Icon1.ico"; }  }
public string Icon2 { get { return @"C:\MyIcons\Icon2.ico"; }  }
public string Icon3 { get { return @"C:\MyIcons\Icon3.ico"; }  }

Application is working fine and I am able to see the icons. Icon file contains icons for different resolutions (64x64, 32x32, 16x16). Application is showing me 48x48 icon. Since I don't need such huge icons I want that instead of getting 64x64 icon i get 16x16 icon. What should I do. How I get a specific resolution icon from icon file path.

1
Possible duplicate question stackoverflow.com/questions/952080/…Magnus Eklund

1 Answers

0
votes

Here's a similar topic that might help you find what you're looking for:

How do you select the right size icon from a multi-resolution .ico file in WPF?.