Image Not Loading Onto PushButtonData
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am having a slight issue trying to utilize the PushButtonData.LargeImage functionality in Revit 2018. When making UI elements for a Ribbon tab that I have created, I am attempting to load an image from an external library onto the button for my UI element; however, it does not seem to be working. The code I am currently trying to use is as follows
PushButtonData ductPushButtonData = new PushButtonData("Duct", "Duct", ExecutingAssemblyPath,
"MyDuctUI.Commands.Duct.DuctStartCommand");
ductPushButtonData.LargeImage = new BitmapImage(new Uri(@"pack://application:,,,/ImgResMan;component/Images/RectDuct.png"));My first assessment of this matter was that maybe the 'LargeImage' or the 'BitmapImage' calls were not liking the fact I was using a .png. I did switch over to a .bmp and attempt this; however, no change. If I take the BitmapImage call and try something like..
BitmapImage bmp = new BitmapImage(new Uri(@"pack://application:,,,/ImgResMan;component/Images/RectDuct.png"));
...I can see that the `bmp` variable has a value with width, height, and data behind it. Indicating that it is successfully creating a BitmapImage object. The image itself is attached to this post. This tells me, at least, that A) my Assembly is being loaded and is accessible to my Plugin and B) there is valid image data being created. For reference, I am utilizing the System.Reflection.Assembly.LoadFrom() routine to load up my library with images/icons.
Can anyone help me fathom why my image is not loading onto my UI element? It does appear that the UI element is adjusting for an image being there, but alas, no image. Are there any particular parameters regarding the utilization of PushButtonData.LargeImage that I may not be aware of such as size maximum, transparency limitations, etc. etc?