I'm after help if possible.
I'm struggling making a hyperlink in a data standard datacard open internet explorer?
I've have a hyperlink that is calculated from other properties on the datacard on an ECO. The hyperlink shows correctly as a text field and can be clicked on, however nothing happens when I do.
I think I need to create some code to open IE at the correct address but not sure where that should go ... Should I try add it to the default.ps1 or create something in c# and link that somehow?
Any ideas and help much appreciated.
Cheers
Hi Chris, I replied to your question posted on LinkedIn, but for completeness, here again the answe: you probably have discovered the <Hyperlink NavigateUri="http://www.coolorange.com" /> tag. In order to start an Browser with your URL, the RequestNavigate event must be implemented, here a link: http://stackoverflow.com/questions/10238694/example-using-hyperlink-in-wpf.
You could do this with DataStandard and powerShell, but I would rather suggest a simpler and more common approach.
The Hyperlink tag offers also a Command attribute, like a Button. You could bind the Command attribute to a PowerShell function and let such function start the browser with the URL. For the URL, instead of using the NavigateUri attribute, you could use the CommandParameter. This way, when you click the URL, your function will be called with the URL as command parameter. This is how it looks:
<TextBlock>
<Hyperlink Command="{Binding PsCmd[GoToLink]}" CommandParameter="http://www.coolorange.com">
coolOrange
</Hyperlink>
</TextBlock>
The PowerShell function, in my case called GoToLink, looks like this:
function GoToLink
{
$proc = New-Object System.Diagnostics.ProcessStartInfo($mvparam)
[System.Diagnostics.Process]::Start($proc);
}
The variable $mvparam will contain the command parameter, so your URL, and the function starts a new Windows process with the URL. The operating system recognizes the URL format and start the standard web browser.
i hope this helps!!
ciao
marco