I am trying to make a WebBrowser control on my Windows 7 Phone app transparent, so it can have the same theme as the rest of the app, but I have had no success with anything I have tried. I need to still be able to see the HTML text, but just have the background be transparent. Using CSS in the control doesn't seem to work, and I can't get it to work via XAML either. Is this possible? This post, was not encouraging.
This isn't possible. The browser engine always renders a background color for the HTML page. You can assign a color to the BODY tag but a value of 'transparent' will always end up white. The Background color you assign to the WebBrowser XAML element really has no effect as the browser engine essentially renders over the top of it.
Your best bet to match your app theme is to pass the app theme background color into the HTML page via InvokeScript to a Javascript function that will then set it on the BODY element. This assumes that you have control of the HTML content you are loading. (Also, don't forget to enable script via IsScriptEnabled.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With