From b5e573c789344dc30efde7cd0d5d1b3e27a276a7 Mon Sep 17 00:00:00 2001 From: Morten Nielsen Date: Fri, 26 Jul 2024 08:50:30 -0700 Subject: [PATCH] Raise hyperlink event for field links https://github.com/Esri/arcgis-maps-sdk-dotnet-toolkit/issues/576 --- .../Controls/PopupViewer/FieldsPopupElementView.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/FieldsPopupElementView.cs b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/FieldsPopupElementView.cs index 08a9a10ff..b9a0af058 100644 --- a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/FieldsPopupElementView.cs +++ b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/FieldsPopupElementView.cs @@ -18,6 +18,12 @@ using Esri.ArcGISRuntime.Data; using Esri.ArcGISRuntime.Mapping.Popups; using Esri.ArcGISRuntime.Toolkit.Internal; +#if MAUI +using Esri.ArcGISRuntime.Toolkit.Maui; +#else +using Esri.ArcGISRuntime.Toolkit.UI.Controls; +#endif + #if MAUI using TextBlock = Microsoft.Maui.Controls.Label; #else @@ -134,7 +140,7 @@ private void RefreshTable() gestureRecognizer.Tapped += (s, e) => { if (uri is not null) - _ = Launcher.LaunchUriAsync(uri); + PopupViewer.GetPopupViewerParent(this)?.OnHyperlinkClicked(uri); }; t.GestureRecognizers.Add(gestureRecognizer); t.FormattedText = new FormattedString(); @@ -144,7 +150,7 @@ private void RefreshTable() hl.Click += (s, e) => { if (uri is not null) - _ = Launcher.LaunchUriAsync(uri); + PopupViewer.GetPopupViewerParent(this)?.OnHyperlinkClicked(uri); }; hl.Inlines.Add("View"); t.Inlines.Add(hl); @@ -234,4 +240,4 @@ public Style FieldTextStyle PropertyHelper.CreateProperty(nameof(FieldTextStyle)); } } -#endif \ No newline at end of file +#endif