-
Notifications
You must be signed in to change notification settings - Fork 1.9k
WebView Background Color Property Changing Doesn't Work #12773
Comments
Hi, @osmanghaziurdu - thanks for submitting this issue! Would you mind clarifying a bit more on what you're use case is? What exactly are you trying to change the color of? You unfortunately won't be able to change any colors or anything inside the WebView itself; however, if you're trying to set the background color of the space around the WebView, that's definitely feasible! You can try something like the following:
If I'm misunderstanding your issue or if this solution doesn't work, please let me know! If you could also share a project replacing this issue, that would also be very helpful. Thanks again, and hope this helps! |
I reproduced this as well. WebView has the following property: BackgroundColor. Setting this property to any color - has no effect. If wrapping the WebView in a StackLayout is required, than the property BackgroundColor of WebView is misleading (it does not work/has no effect) and should be removed altogether. |
@osmanghaziurdu @atifc thanks for sharing - I can definitely see why this is confusing! Our code allows you to set a This would be easier to understand/see if we could add So for now, wrapping the WebView in a StackLayout or another layout would be a workaround. Rather than setting the color of the space around the WebView (as I've been assuming up to this point), if your goal is to change the background color of the WebView itself, you'd have to add some custom css. Hope this helps! :) |
Thank you for clearing this up @rachelkang, it makes much more sense now. I used custom CSS to achieve what was required. |
You can also set the following in the renderer of WebView
|
Ran into the same issue, at least an option for making the background transparent would be awesome! |
Ran into the same problem in .Net Maui. My work around for this is to get the HTML as string and add the background color to the HTML body tag directly. |
Description
I am using webview inside Content Page (XAML). When i set webview background color to e.g black or blue, color does not changes. Even if i use webview inside layouts such as stacklayout and try to change background color of layout, this condition also doesn't fulfills
Steps to Reproduce
Expected Behavior
Color should be changed to something like black or blue or red etc
Actual Behavior
Nothing happens and webview background remains unchanged
Basic Information
The text was updated successfully, but these errors were encountered: