how to navigate on the button click - silverlight

I am developing a SilverLight Project using SilverLight BusinessApplication Template RIA services.I want to navigate from one xaml page to another xaml page on the click of a Button that is placed on the first Xaml Page. i don't want to use Hyperlink button.
Any Suggestions...

Duplicate here:
Put this inside the event handler of the button:
this.NavigationService.Navigate(new Uri("nextpage.xaml", UriKind.Relative));

Related

Add a new page at runtime in WPF on button click

In my application I need to create a new XAML page/usercontrol at runtime. The use case is like:
User Clicks on add page button on the main window.
A new XAML page gets added to the application.
User can design the page by adding controls from a custom tool bar and save the page.
User can also add event handler to navigate between pages.
Please let me know how can I go about this.

Silverlight App inside WPF WebBrowser?

I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.
Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?
Thanks everyone,
-Tom
Attach an event handler to the WebBrowser.Navigated event.
Have the close button in the Silverlight application use:-
HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));
When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.
Use Javascript and the HTML DOM as the glue here.
For example, when the SL app close button is clicked, have Silverlight trigger some Javascript code that sets a flag, or alternately, raises some HTML document event.
The WPF control could poll that flag in the HTML + Javascript, or alternately listen for that HTML document event, then close the user control.

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.

open new silverlight window when button click

I created a Silverlight window and I want it to appear when I press a button. How can
I do that? It doesn't has a "show" method...
To open a new address in a new window use:-
HtmlPage.Window.Navigate(new Uri("the address here"), "_blank");
see:
Silverlight Simplified MVVM Modal Popup
http://www.codeproject.com/KB/silverlight/MVVMPopUp.aspx
If you want to browse to a new silverlight application hosted in another html page you should use the NavigationService class to accomplish that.
If you on the other hand want to display another view defined in your silverlight application then you should do something like this Silverlight 3 Navigation.

Do WPF hyperlinks only work in pages?

I'm new to the Hyperlink control. I wish to have a hyperlink in a regular WPF window which will navigate to a URL by opening the standard browser. I have added the hyperlink, but it does nothing.
Before I implement a handler to do the work myself, can anyone please confirm that the Hyperlink control will navigate only within pages?
You will need to do it yourself.
The simplest way to do it is to handle the Hyperlink.RequestNavigate event and call Process.Start with the URL. (This will open the default browser).

Resources