views:

172

answers:

3

Hi all,

I have a slide show of some images in my silverlight application.

When user clicks on any Image I want want to redirect to a different page.

How to implement this.

Please help.

A: 

See here: http://forums.silverlight.net/forums/t/5769.aspx

Konamiman
+1  A: 

From Silverlight you can catch/handle the MouseLeftButtonUp event and do

HtmlPage.Window.Navigate("http://www.example.com");
soren.enemaerke
Check this url http://msdn.microsoft.com/en-us/library/system.windows.browser.htmlpage_members%28VS.95%29.aspxI can't find Navigate as member of HtmlPage class. Please guide me.
Himadri
Updated with correct syntax...sorry for the confusion
soren.enemaerke
+1  A: 

HTML.Navigate won't open a new page in several browsers. This makes it kind of worthless.

However, HyperlinkButtons magically make it work. I don't know how, so I just create a one of those, give it the URI that I want to open, and click it (all from code). if I set the TargetName of the HyperlinkButton to "_Blank" then it will open in a new page.

Calling a buttons click event from code isn't the easiest either, but I found some code somewhere that did it. Here's the code that you will need to open a new page:

    HyperlinkButton button = new HyperlinkButton();            
    button.NavigateUri = new URI("The URI To Go To");
    button.TargetName = "_Blank";

    HyperlinkButtonAutomationPeer hyperlinkPeer = new HyperlinkButtonAutomationPeer(button);
    IInvokeProvider invokeProvider = hyperlinkPeer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
    invokeProvider.Invoke();
thepaulpage
I wish there was an easier way to do this. I guess it just goes to show, the microsoft people don't test on macs.
Jeremiah