Archive

Archive for the ‘Silverlight’ Category

Redirecting the aspx file from Silverlight

December 29, 2009 Leave a comment

Code for redirecting the ASPX file from Silverlight is as below

string url = “https://nkdeveloper.wordpress.com”;
HtmlPage.Window.Navigate(new Uri(url, UriKind.Absolute), “_blank”);

 

(or)

HtmlPage.Window.Navigate(new Uri(“https://nkdeveloper.wordpress.com “));

(or)

HtmlPage.Window.Eval(“window.open(“https://nkdeveloper.wordpress.com”, ‘_self)”);

 

🙂

Advertisements
Categories: Silverlight

How to redirect the XAML file in silverlight

December 29, 2009 2 comments

Here is the code to redirect with in silverlight(XAML) file .

public static void Navigate(UserControl newPage)        {

            UserControl oldPage = root.Children[0] as UserControl;

            root.Children.Add(newPage);

            root.Children.Remove(oldPage);

        }

Add the above method in App.xaml file . Then modify the Application_Startup method as below code.

private void Application_Startup(object sender, StartupEventArgs e)        {

            root = new Grid();

            root.Children.Add(new MainPage());

            this.RootVisual =root;

        }

Then you can add the below code line in the page as want for example you can put it inside the button click event

App.Navigate(new MarketCenter());

🙂

Categories: Silverlight
%d bloggers like this: