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 Andrew,
Thank you for the sample. I will take a look at it and consider whether I will then use a CreationFilter. But the question is, can I then still swap the image at runtime with the menu open? The CreationFilter, as I understand it, is only run once, when the controls are created. (Hence the name :-)) I will get back to you as soon as I have sorted my thoughts a bit.
Regards
Hello Thorsten,
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
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 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.
Please let me know if you have any other questions or concerns on this matter.
ToolbarsManagerPopupDrawFilterTest.zip
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.