I am using the Message Label ( https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Framework#message-label )in a number of my custom Add-Ins. If I set the "Show Help" property to true, the user will see the "Learn More" hyperlink. The problem is when the user clicks the hyperlink, they are taken to the ArcGIS Pro website. I can set the property (Hyperlink.Click="MessageLabel_Click") and in the code-behind, i can point the messageLabel_Click event to load my help file and that works but it still loads the Pro website. How do i prevent the loading of Pro's website when the user clicks the "Learn More" hyperlink?
Solved! Go to Solution.
Hi,
As a workaround I could suggest update MessageLabel as below:
<controls:MessageLabel MessageType="Information" Severity="High" ShowHelp="False">
<TextBlock>
<TextBlock>Please open a map with bookmarks</TextBlock>
<Hyperlink NavigateUri="https://learn.microsoft.com/" RequestNavigate="Hyperlink_RequestNavigate">Learn more</Hyperlink>
</TextBlock>
</controls:MessageLabel>
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
System.Diagnostics.Process.Start(new ProcessStartInfo
{
FileName = e.Uri.ToString(),
UseShellExecute = true
});
e.Handled = true;
}
Hey @JonathanDewalt
In the MessageLabel_Click, would you be able to mark the event as handled? That may end up solving the loading of the Pro website!
Cody
Hey @JonathanDewalt
Hmm so it looks like the loading of the website is happening after the handling. Would it be possible to manually create a hyperlink or some type of tool tip with a custom hyperlink instead of the "Show Help" button enabling the Learn More button? It may be an inherent function that cannot be changed if the handling did not end up solving it.
Cody
Hi,
As a workaround I could suggest update MessageLabel as below:
<controls:MessageLabel MessageType="Information" Severity="High" ShowHelp="False">
<TextBlock>
<TextBlock>Please open a map with bookmarks</TextBlock>
<Hyperlink NavigateUri="https://learn.microsoft.com/" RequestNavigate="Hyperlink_RequestNavigate">Learn more</Hyperlink>
</TextBlock>
</controls:MessageLabel>
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
System.Diagnostics.Process.Start(new ProcessStartInfo
{
FileName = e.Uri.ToString(),
UseShellExecute = true
});
e.Handled = true;
}
Thanks you. That work around will do just fine.
I have another question then for you. This fixed the call to my chm help file for the Message Label. Awesome! I also want to provide custom help support for my dockpanes and ProWindows.
For DockPanes, I add "hasHelp=true" in the daml and then in the dockpanes viewmodel I override the OnHelpRequested method and this works great.
As for the ProWindow, I can add "ShowHelpButton=True" to the xaml and this will display the help button on the form but I have yet been able to find a way to intercept the help click before, yes, it loads the esri page.
Any ideas?
I ended up, for ProWindows, using PreviewKeyDown to intercept the F1 key to got to my help file and then set that to e.Handled = true to stop it from loading the ESRI support page. Unfortunately, the ShowHelpButton is useless.
Thanks. We are still on 3.3 and will be there for awhile. I will keep this in mind and update my addins when the time comes.