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.
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.
From Silverlight you can catch/handle the MouseLeftButtonUp event and do
HtmlPage.Window.Navigate("http://www.example.com");
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();