How can i set an transparent image to an ImageAndTextButtonUIElement so only the image is displayed an not the border and the button background. I tried using the Appearance.ImageBackground and set the ThemedElementAlpha to Transparent. But now no Image is displaed at all. When using ImageAndTextButtonUIElement.Image then the image is shown but with border and button background.
Any suggestions?
Thanks and regards
Thorsten Pontow
Hello Thorsten,
I have been investigating into the requirement you are asking for here, but before I make a recommendation, I would just like to get a better idea of what exactly you are trying to achieve in this case. From your description, it sounds like you likely have a CreationFilter going on for one of the Infragistics for Windows Forms controls since you are modifying the ImageAndTextButtonUIElement, but this could be a number of different controls.
Can you please provide some information on the end-goal that you are looking to achieve in this case, just in case a CreationFilter is potentially not necessary?
Please let me know if you have any other questions or concerns on this matter.
Hello Andrew, actually i have a DrawFilter for a ToolbarManager and i place an onto a PopupMenuTool in UIElementDrawFilter.DrawElement() because i like to offer an additional user interaction on every menu item. It all works fine but I just can't get it to show only the image (a png with transparent background) without the border and the background color of the button (like an menu item image is displayed).
I have put together a sample project using the DrawFilter you have provided, but at the moment, I cannot seem to reproduce the behavior you are seeing. For reference, I am attaching the sample project I used to test this.
On my end, I am only seeing the image without the extra button background color and I’m rather unsure as to why you are seeing this button at the moment. If you could, would it be possible for you to please modify this sample project such that it reproduces the behavior you are currently seeing and send it back? This would allow me to reproduce the behavior locally and hopefully provide a more accurate solution to the issue you are seeing.
ToolbarsManagerPopupDrawFilterTest.zip
Thanks for the sample project. I used your image "RedX.png" in my project. If the MenueItem is not activated then it looks good because the background of the image is white. But if I hover over the MenueItem with the mouse and the background of the item turns yellow, then you can also see the button or image in white. The large image on the left of the item with a transparent background always looks good.
My real core question now is: how can I put an image with transparent background on the ButtonUIElement so that the background of the item always shows through?
I have attached two screenshots for illustration.
MenueItemWithImageRedX.zip
I have been discussing this behavior with our development teams, and the recommendation that I was given in this case was not to use a DrawFilter at all, but rather a CreationFilter to add the ImageAndButtonUIElement. Doing this appears to allow the transparent image to be respected, and I am attaching a sample project to demonstrate.
A big part of this was making sure that the image itself also is using a transparent brush in the areas that you wish for it to be transparent. If it is not, like it appears that the RedX.png in the previous sample I sent you actually wasn't, it will continue to show the white background like is shown in your screenshots.
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
ToolbarsManagerPopupDrawFilterDemo.zip
StollfussMedienOriginal.zip
The orginal style isl-File from which we started our own isl-File. Even with this one the icon is not transparent while using a CreationFilter.
Without using the style everything is ok!
So i only need a way to prevent AppStyling for the ImageAndTextButtonUIElement. In this forum i found some posts that suggest to implement an own ImageAndTextButtonUIElement subclass and override the DrawTheme() method and return false. Is that the right way to do it?
If you are using a Style Library (isl), you're going to have to jump through some hoops to get the button to ignore it. Here's an updated sample.
7411.ToolbarsManagerPopupDrawFilterDemo.zip
Hello Andrew, hello Mike,
I have adapted Mike's last sample to my project. Now everything works fine for me. Thanks a lot for the support.
Regards
Thank you Mike! I will have a look at your updated sample.