Push WindowsFormsHost element into the back - wpf

My wpf app has a "Open PDF" feature and I'm using PdfViewer from the PdfPrintingNet & PdfViewerNet libraries. My issue is that since my app can be windowed and resized the PDF viewer gets drawn in front of my scrollbars thus rendering the use of them moot and the layout looks awry. Is there a way where I can put my PDF window to the back and not drawn over my scrollbars?
Here is how I have my PDF view:
<!-- winforms host with embedded PDFPrint.net viewer -->
<WindowsFormsHost x:Name="_pdfViewerHost" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
<pdfview:PdfViewer IsCalledFromWPF="True" />
</WindowsFormsHost>

This is caused due to how the WindowsFormsHost is rendered.
They call it the "airspace" problem.
It's always drawn on top of everything else, and there is no way you can change it unfortunately.
I would recommend finding a native WPF PDF viewer control.

Related

Hide navigation buttons

I'm developing a WPF .NET 4.0 application.
When I moving from page to page, the navigation toolbar is showing.
But I really don't want to.
I every page I've set :
ShowsNavigationUI="False"
When I change the page, this is showing:
Any ideas ? thanks
Are you using a frame to navigate between pages? if so:
<Frame x:Name="mainFrame" Content="Frame" NavigationUIVisibility="Hidden"/>
Notice the NavigationUIVisibility set to Hidden.
-Edit: You can use this in .NET 4.0 (I have used it.)

WP7 Silverlight + XNA: application bar on -> no longer fullscreen xna rendering?

I'm working on a hybrid silverlight/XNA app for WP7. I want the XNA part to render the full screen, exept for an application bar, which is silverlight. Without the application bar on, XNA renders fullscreen. As soon as i turn on the application bar, XNA leaves black bands on the top and bottom of the screen (i'm working in landscape mode). The application bar does use the full screen height.
The XAML contains the following lines:
mc:Ignorable="d" d:DesignHeight="480" d:DesignWidth="728"
shell:SystemTray.IsVisible="False">
Does anyone know how to fix this?
I think it's the same problem as this article in French. (because ApplicationBar and SystrayBar are two elements of the shell)
http://blog.naviso.fr/wordpress/?p=1304

How to display HTML in Silverlight application?

I would need to display some basic HTML (just some paragraphs, unordered lists and hyperlinks) in my Silverlight application. How would I go about that?
Which control to use?
Try this link for starters: http://www.wintellect.com/CS/blogs/jprosise/archive/2009/12/22/silverlight-4-s-new-html-hosting-support.aspx
Here is the relevant part:
Another of the new capabilities that Silverlight 4 brings to the
platform is the ability to host HTML content inside a Silverlight
control. This support isn't limited to static HTML content; the
content can be interactive and can include script. It can even be
Flash content or content that includes other Silverlight controls.
To host HTML content in Silverlight, you can use either a WebBrowser
control or an HtmlBrush. One way to display HTML content is to fire up
a WebBrowser control and point it to a URL:
<WebBrowser x:Name="WebBrowserControl" Source="http://www.bing.com" />
Another way to do it is to call NavigateToString and pass a string of
content to the WebBrowser control:
WebBrowserControl.NavigateToString("<h1>Hello, Silverlight</h1>");
HTML hosting is not available to in-browser apps (it applies to
out-of-browser applications only), and if an OOB lacks elevated
permissions, it can only display content that comes from the same
domain as the Silverlight application. However, you can use a little
trick to display cross-domain content in OOBs that run without
elevated permissions—simply pass an IFRAME targeting the remote
content to NavigateToString:
WebBrowserControl.NavigateToString("<iframe src=\"http://www.bing.com\" style=\"width: 100%; height: 100%\"></iframe>");
You can render HTML content with HtmlBrush, too. The following XAML
snippet paints a Rectangle with content retrieved from Bing:
<WebBrowser x:Name="WebBrowserControl" Source="http://www.bing.com" />
<Rectangle>
<Rectangle.Fill>
<HtmlBrush SourceName="WebBrowserControl" />
</Rectangle.Fill>
</Rectangle>
One difference between WebBrowser and HtmlBrush is that the former
displays "live" content, while the latter does not. Another difference
is that HtmlBrush can have transforms applied to it, while WebBrowser
cannot. For snazzy visual effects involving HTML content like the HTML
puzzle demoed at the PDC, you'll probably find yourself using
HtmlBrush. To display live, interactive content, you'll find
WebBrowser more useful instead.
One of the really cool things about the WebBrowser control is that you
can use its InvokeScript method to call JavaScript functions in
content hosted by the control. Conversely, JavaScript hosted inside a
WebBrowser control can use window.external.Notify to raise
ScriptNotify events that can be handled in C#.
You could use HtmlBrush or webbrowser control.

Background HTML visibiltiy in Silverlight Full Screen Mode

I am creating a page with Silverlight component and some HTML controls.
On enabling Silverlight's full screen, I am unable to view the background HTML controls. Even if I set the xaml's background to transparent.
Please let me know if it's possible to view the HTML controls in full screen mode of Silverlight or not.
Thanks
I doubt that such thing is possible, for security reasons, as the keybordsupport in Fullscreen is. It would enable you create such things as a app totally visible observing the movements.
But I might be wrong !
Fullscreen mode takes the content currently restricted to rectangle on hosts window (the Browser client area window) and displays it on full screen window. This full screen window is a new window and contains only the Siverlight content.
When silverlight is rendering in a windowless mode it is simply rendering directly on to the host window. When you got fullscreen mode in Silverlight you are not affecting the hosts window, fullscreen effectively suppends windowless mode as it needs a new window of its own to render on.

opening a silverlight childWindow overlay on the viewport of the browser

I would like place a silverlight contol on an HTML page --- something about the size of a typical calendar control. However when the user selects a day on the control a bigger canvas opens up on top of the containing page --- something like a modal dialog box that you might find with the AJAX.
I'm wondering if this is even possible with Silverlight, or is the silverlight content limited in size to the DIV element on the host page?
UPDATE: after doing some poking around, I think the answer will involve using the ChildWindow control introduced with Silverlight 3. However I'm still at a loss how to have the ChildWindow display ontop of the existing content
I know one way, you will need javascript event on the page itself to expand a silverlight object to fit the whole page then build you silverlight event accordingly.

Resources