简体   繁体   中英

How can I get toolbox icon of standard WPF control at runtime?

I tried something like this:

var attrs = typeof(System.Windows.Controls.ComboBox).GetCustomAttributes(typeof(System.Drawing.ToolboxBitmapAttribute), true);

...but attrs is empty collection. I also tried to look up for icons resources in assemblies and nothing found.

That's because the ComboBox class is the actual run-time class, which has no such attributes. You'll need to find the design-time class. I've briefly looked through some of the WPF assemblies but couldn't find it.

我想大多数WPF标准控件的图标都包含在Visual Studio图像库中: https : //msdn.microsoft.com/zh-cn/library/ms246582.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM