Programatically zoom out webpage in webbrowser - wpf

In my application I have created a webbrowser in which the page loads in Zoomed view.I need the page in zoomout position in default.Is it possible.Please help me.

The best way to do that is with Javascript. You can run the script from C#.
Here you have a sample:
http://blogs.msdn.com/b/mikeormond/archive/2010/08/26/calling-javascript-functions-in-windows-phone-7.aspx

Related

Show a Sothink menu on top of a Silverlight iFrame

I have a Sothink menu on a web page and below it is a Silverlight iframe application. Currently the iframe is covering some dropdown menu items.
I have tried solving this problem with z-indexing, windowless, and wmode. I can not change the original code of the application but when I view the source of the iframe's page, I see that the developer commented out the windowless option because it interfered with another part of the program.
The only way I have tried to insert it into my page is through this code:
<iframe src="iframe-code-url.com" frameborder="0" style="background-color:#FFF;" scrolling="yes" width="940px" height="500px" wmode="opaque" windowless="true"></iframe>
I am open to any and all suggestions. I have done a lot of research and I have not found anything.
You must set Windowless=true on the Silverlight host object, not the iFrame. If you can't access the host object, you cant enable Windowless mode and so you cant do what you want.
See here for more on Windowless Silverlight Objects
Ideally, you should host the Silverlight XAP file in the same site as your web page.

Scroll to bottom of browser with silverlight

I have a project in Silverlight which I'm adding controls at run time.
Every time I'm adding a control I want to scroll browser to the bottom of the page?
Any idea to how to scroll from Silverlight?
Thanks
if your Scrollbar is created by your application using the ScrollViewer you can do the following:
ScrollViewerName.ScrollToVerticalOffset(double.PositiveInfinity);
if your scrollbar is created in the HTML page you'll have to invoke a script
Silverlight Script Invoke
HtmlPage.Window.Invoke("ScrollToBottom");
Java Script
window.onload=toBottom;
function ScrollToBottom()
{
window.scrollTo(0, document.body.scrollHeight);
}
Most easy way to do it:
Use textchange event and in that execute richtextbox.selectall();

google maps silverlight

I am working on silverlight 4 application and need to implement google maps in the same app.
Now to implement the google maps, i was planning to use WebBrowser control but when i used it i found out that it will run only in out of browser mode.
So, i decided to use another approach since i want to implement google maps inside of my application. I then used http://csharperimage.jeremylikness.com/2010/09/hosting-html-in-silverlight-not-out-of.html alternative which was having to use iframe to show web page there. It was seems to be good alternative in start. But Here comes another twist.
On top of my app, i have one top MENU for navigation, its a classic web menu, user hover over the menu item and its sub item will expand vertically.
Now just underneath the MENU i have above HTML control to display my map. Now since the HTML browser control has higher z-Index so my vertical sub menu is goes underneath the google map and hence it not visible.
And giving silverlight app higher z-Index the iframe for HTML does not show up as it goes behind the app.
So how can i get my HTML MAP and MENU both to work? If you guys have any other alternative to implement google maps then please let me know
Thanks
I would recommend using the Silverlight Bing Maps control, with the tile-source set to Google Maps. This will give you the maps you desire, via a proper Silverlight control. You can find out about how to provide a custom tile source from Google here:
http://www.scottlogic.co.uk/blog/colin/2011/02/google-sky-on-windows-phone-7/

How do I show HTML in an WPF application?

I am new to WPF and need some help and guidance.
I am building a client app in VS2010 that will store HTML in a database, and I need to display this html with images in my application when the user clicks a "preview html" button.
so my question is,
How do I display my stored HTML as a web page in a wpf page? Does anyone know of a sample application that does this?
Any help is appreciated.
Load the html in web browser control.
When the HTML is saved, render it and save a preview image. Then just pull the preview image and display that.
If you can't, you can always just pull the HTML and run it through your full render sequence, whatever that is.

Display modal Silverlight popup on HTML button click

I have the following desired workflow: on HTML button click a Silverlight modal popup (dialog) must be displayed. No Silverlight content is displayed before HTML button click and no Silverlight content must be displayed after exiting from modal SL popup.
According to our customer inclination we couldn't use another technology for such popups.
Any thoughts on how to accomplish mentioned workflow?
I'm quite new to Silverlight so all the ideas are highly appreciated.
The requirement is a little unusual, but here goes...
I am assuming you have a Silverlight test project and know enough HTML/JScript to popup a window, as you tagged this question as Silverlight only.
Think of Silverlight as just another component you can put on a web page. Any web page. It can be a small control, or fill a HTML window.
In your case you want to simply put your Silverlight startup code into a html page that a popup window can show. The popup window will be triggered by JScript attached to a button.
The Silverlight startup code is usually generated for you in a HTML test webpage in your Silverlight Webproject. Copy it from there.
If you need more detailed instructions for a specific example, please provide more detail.

Resources