How to set the background of webview transparent in winRT? - c#

I have a web view which loads html content in a page.How its back ground can set to transparent.I set the html background transparent.

Try this:
<WebView DefaultBackgroundColor="Transparent"/>

To my knowledge that's not possible since this an actual HTML page you are rendering inside the Webview.
The webview does not derive from Control and because of this, it does not support the same templating possibilities as if you we using a control that derived from Control.
Also since browsers can't have a transparent website, the website will appear white per default.
This may not directly relate to your question however I think it's still important to know when using the Webview. There is some important remarks from the documentation on MSDN concerning UI and rendering:
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 the SourceName property. WebViewBrush does not have this overlay limitation.
If you want to display an interactive WebView that only occasionally has overlapping content (such as a drop-down list or app bar), you can temporarily hide the WebView control when necessary, replacing it with an element using a WebViewBrush fill. Then, when the overlapping content is no longer present, you can display the original WebView again. For more info, see the WebView control sample.
For more information see the full documentation.

They have fixed it in Windows Universal App.
If you set DefaultBackgroundColor to Transparent
and
body, html {
background:transparent;
}
you will get what you want

Related

Use a specific viewport width in a WebBrowser component

How do I limit the width of a webpage inside a WebBrowser component so that the content is displayed in a "mobile" format, no horizontal scrolling is required and the font is still readable?
I have a relatively small WebBrowser component that needs to display mainly text websites alongside the rest of the form's controls. I'd have to make it really wide so that the font is readable and the whole text line fits inside the control. If I could somehow limit the viewport, like it happens in most browsers when you simply zoom in (no horizontal scrolling needed, the site resizes itself, provided it is responsive to narrower screen resolutions). Changing the zoom in the WebBrowser control introduces scrollbars and doesn't change the way the entire page is rendered.

Moving popup to back - C# UWP Universal Windows

Is there a way to move a popup to back, so it does not always display on the front of the application?
I have a canvas that displays many shapes, which are resizable. To get the resize box I am using a popup, because it was suggested that the best way would be to use adorners, but these are not used in UWP, so the alternative are popups. It works quite well, but when I have another element overlaying my canvas and resizing was enabled on a shape, the popup elements (resize thumbs/nodes) are displayed on top of the element that should be overlaying the canvas. Is there a way to tell the popup that it should not display on a "higher level" than my canvas?
A Popup control is intended to be displayed on top of all other content so it seems you're not using an appropriate control for what you are trying to achieve.
Without seeing more of your code and having a clearer idea of what you're doing (repro?) it's hard to suggest what you should do. However, I'd avoid resizing control that aren't on top of the viewable area or having multiple items in a resizable mode (or just with adorners displayed) at a time. Both of these should avoid what you're reporting.

How do I disable user input on a WebView?

I'm having tons of issues trying to integrate Microsoft's WebView in my WinRT application and one of them is the following. I want to display the WebView and its content (which comes from a local offline server but that works like a charm) and I don't want the user to be able to click around ; basically completely disable user input on this WebView.
There is no IsEnabled property on this control so I tried:
Catching the many Pressed-like events and setting the Handled property of the event object to false in each one of the handlers
Catching the GotFocus event of the WebView to set the focus on another control immediately
Putting the WebView in a ContentControl, then set the IsEnabled property of the ContentControl to false
Obviously, none of these workarounds did work so I'm facing a brickwall here. Maybe some of you can help find a solution?
More details if that can help: the web page that is loaded contains an HTML5 canvas where the user can draw things (like in Microsoft Paint). There are also links (ahref). I dont want the user to be able to draw on this canvas, and I don't want them to be able to click on these links as well!
Thanks
Hi you can use a if the content is not animated then you can use a Rectangle instead of the WebView and in the rectangle you use a WebViewBrush, this actually take the webview and render it's content as an image on the rectangle. since it is an image no interaction is available on the rectangle, but if you have animation then you will lose them.
Generally this trick is used to show content onto the webview.

Webview always on top (Metro app)

I've noticed that whenever you have a WebView on your screen, it will be the top-most element of the UI. Is there a way to set a z-index?
There is no way to set z-index or anything similar, WebView is always on top of the XAML ("Airspace" issue). You have to hide web view if new content completely hides WebView or use WebViewBrush control.
http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx#AN2
http://blogs.msdn.com/b/priozersk/archive/2012/08/13/how-to-display-charms-on-a-top-of-the-webview.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webviewbrush.aspx
From https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.aspx:
Note The "airspace problem" has been fixed starting with Windows 8.1.

How to print content of scrollable control

I was wondering what is the best way to print entire content of scrollable control. I was trying to print a control in several ways, however all the time I was only able to draw visible content of control. So far I tried to use
PrintForm // there is nothing I can do with this because it requires a form not a control
I was also trying to use controlName.DrawToBitmap() method however this function captures only the visible area of control.
What is the best way to draw this kind of controls ?? I would like to avoid scrolling control's content in order to capture all control's element.
I would suggest that you create an invisible to the end-user form (for examlpe, position it at (-10000, -10000) and this form should have the size enough to display the ScrollableControl without scrollbars. This way you will be able to workaround this problem.

Categories