Skip to content

Commit 08ce4ba

Browse files
committed
Skip rendering unknown popup element types
1 parent eec6d06 commit 08ce4ba

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupElementItemsControl.Windows.cs

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ namespace Esri.ArcGISRuntime.Toolkit.Primitives
2626
/// </summary>
2727
public partial class PopupElementItemsControl : ItemsControl
2828
{
29+
private static DataTemplate UnsupportedPopupElementTemplate = new DataTemplate();
30+
2931
/// <inheritdoc />
3032
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
3133
{
@@ -59,6 +61,10 @@ protected override void PrepareContainerForItemOverride(DependencyObject element
5961
// always returned as TextPopupElement.
6062
Debug.Assert(false);
6163
}
64+
else
65+
{
66+
presenter.ContentTemplate = UnsupportedPopupElementTemplate; // Renders empty / skips
67+
}
6268
}
6369
}
6470

src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupElementTemplateSelector.Maui.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public class PopupElementTemplateSelector : DataTemplateSelector
3333
private static DataTemplate DefaultMediaPopupElementTemplate;
3434
private static DataTemplate DefaultFieldsPopupElementTemplate;
3535
private static DataTemplate DefaultAttachmentsPopupElementTemplate;
36-
36+
private static DataTemplate UnsupportedPopupElementTemplate;
37+
3738
static PopupElementTemplateSelector()
3839
{
3940
DefaultTextPopupElementTemplate = new DataTemplate(() =>
@@ -61,6 +62,10 @@ static PopupElementTemplateSelector()
6162
view.SetBinding(AttachmentsPopupElementView.ElementProperty, Binding.SelfPath);
6263
return view;
6364
});
65+
UnsupportedPopupElementTemplate = new DataTemplate(() =>
66+
{
67+
return new Grid() { IsVisible = false };
68+
});
6469
}
6570

6671
/// <summary>
@@ -104,7 +109,7 @@ protected override DataTemplate OnSelectTemplate(object item, BindableObject ele
104109
// always returned as TextPopupElement.
105110
Debug.Assert(false);
106111
}
107-
return new DataTemplate();
112+
return UnsupportedPopupElementTemplate;
108113
}
109114

110115
/// <summary>

0 commit comments

Comments
 (0)