Paul Michaels
Paul Michaels

Reputation: 16705

WinRT WebView Control

I have the following control in a Windows Metro App:

string html = "<html><body>test content</body></head>";
myWebView.Opacity = 0.5;
myWebView.NavigateToString(html);

This works okay, but what I end up with is a blank white background with black text. What I actually want is for this to work with the current Metro style (so match the dark or light background depending on the setting). I've played with the Opacity setting, as above, but it seems to make no difference.

Is there a way to get the WebView control to mirror the current Metro style?

Upvotes: 1

Views: 1558

Answers (1)

GameScripting
GameScripting

Reputation: 17022

This is by design. WebView-Controls don't support any Opacity, cause they are kind of a special control which is rendered on top of everything.

From the MSDN docs:

WebView has the characteristic that other UI regions such as controls cannot be rendered on top of the WebView. This is because of how window regions are handled internally, particularly how input events are processed and how the screen draws. If you want to render HTML content and also place other UI elements on top of that HTML content, you should use WebViewBrush as the render area. The WebView still provides the HTML source information, and you reference that WebView through element name binding and the SourceName property. WebViewBrush does not have this overlay limitation.

Upvotes: 1

Related Questions