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 been investigating into the DrawFilter you have provided, but to be honest I’m a little unsure of the behavior that I am seeing with it. So far, I have not been able to get it to work on my end due to a few missing dependencies as well as the condition that “drawParams.Element” is a PopupMenuItemDescriptionUIElement.
The part that I am rather unsure of in this case is this line and the lines that follow it:
IEnumerable<ImageAndTextButtonUIElement> buttonChildElements = parent.ChildElements.OfType<ImageAndTextButtonUIElement>().ToList();
This makes it sound like you already have a button of some sort within your PopupMenuTool, but in the lines following it appears that you essentially duplicate it and then re-add it to the parent. I might just be misunderstanding the items or objects that you have within your PopupMenuTool, but it seems to me that if there already is a button within your PopupMenuTool, your requirement may be able to be achieved without the use of a DrawFilter?
Would it be possible for you to please provide some additional information on the actual objects / tools that you are placing within the parent PopupMenuTool in this case?
Hi Andrew,
Thanks for the quick reply. I will have another look at the code on it and get back to you soon. Since I would be adding the button to the structure every time I draw it, I check it first. If the button UIElement is already there, then nothing is done. I check it though, maybe there is still an error.
My apologies, it appears that I misread the code of the DrawFilter. I missed the “!” in the check for !buttonChildElements.Any(), and so now I can see that you are only adding the ImageAndTextButtonUIElement if it is not present at that time.
I am currently in discussion with our developers on this issue so that I can provide you with more information regarding your DrawFilter. I hope to have more information for you on this soon.
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
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.
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
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?
Hello Andrew,
I used a CreationFilter with your image as a test and it still didn't work. But your example works correctly. I thought about what the difference between our implementations could be and suddenly I came up with the solution! We use a style (.isl file). When I removed the style usage everything was as I wanted it.
But since we have to use the style mandatory, my question is, what inside the style file do I have to change and how to make it work? I will add our style file as an attachment. Can you help me with that?