开发者

silverlight - file extensions

I am working on a file explorer using Silverlight OOB. I need a way to get and display the icon associated with each file in my application. Note, I only开发者_运维知识库 need to show the icons, I don´t need to open the files.


If I understood you right, you're building something like Windows Explorer and want to mimic its list view by showing the program icons right before their names.

I'm not sure whether OOB has access to the System.Drawing.Icon class, but if so, you can use the following code to get the icon for any given file:

Bitmap icon = System.Drawing.Icon.ExtractAssociatedIcon(filename).ToBitmap();

If not, the only way you can do it is by storing the icons for most common file formats in a dictionary and retrieving them from there based upon file extension.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜