Select to view content in your preferred language

Message Label "Learn More" Hyperlink

207
8
Jump to solution
a week ago
JonathanDewalt
Regular Contributor

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?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

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;
        }

View solution in original post

0 Kudos
8 Replies
CodyPatterson
MVP Regular Contributor

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

0 Kudos
JonathanDewalt
Regular Contributor
I tried e.Handled = true and false and Pro website still loads.
0 Kudos
CodyPatterson
MVP Regular Contributor

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

0 Kudos
GKmieliauskas
Esri Regular Contributor

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;
        }
0 Kudos
JonathanDewalt
Regular Contributor

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?

 

0 Kudos
JonathanDewalt
Regular Contributor

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.

0 Kudos
vanesch
Occasional Contributor

Thanks for posting. Added OnHelpRequested to ProWindow for 3.5

JonathanDewalt
Regular Contributor

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.

0 Kudos