diff --git a/src/Samples/Toolkit.SampleApp.Maui/Samples/OverviewMapSample.xaml.cs b/src/Samples/Toolkit.SampleApp.Maui/Samples/OverviewMapSample.xaml.cs index 67f50353d..254dad6ec 100644 --- a/src/Samples/Toolkit.SampleApp.Maui/Samples/OverviewMapSample.xaml.cs +++ b/src/Samples/Toolkit.SampleApp.Maui/Samples/OverviewMapSample.xaml.cs @@ -5,7 +5,7 @@ namespace Toolkit.SampleApp.Maui.Samples { [XamlCompilation(XamlCompilationOptions.Compile)] - [SampleInfo(Category = "OverviewMap", Description = "Demonstrates various scenarios for the OverviewMap control.")] + [SampleInfo(Category = "OverviewMap", Description = "Demonstrates various scenarios for the OverviewMap control.", ApiKeyRequired = true)] public partial class OverviewMapSample : ContentPage { private bool _symbolToggle; diff --git a/src/Samples/Toolkit.SampleApp.UWP/Samples/OverviewMap/OverviewMapSample.xaml.cs b/src/Samples/Toolkit.SampleApp.UWP/Samples/OverviewMap/OverviewMapSample.xaml.cs index 043aacccb..1bf2fde60 100644 --- a/src/Samples/Toolkit.SampleApp.UWP/Samples/OverviewMap/OverviewMapSample.xaml.cs +++ b/src/Samples/Toolkit.SampleApp.UWP/Samples/OverviewMap/OverviewMapSample.xaml.cs @@ -3,6 +3,7 @@ namespace Esri.ArcGISRuntime.Toolkit.SampleApp.Samples.OverviewMap { + [SampleInfo(Category = "OverviewMap", DisplayName = "OverviewMap", Description = "OverviewMap sample", ApiKeyRequired = true)] public sealed partial class OverviewMapSample : Page { private bool _symbolToggle; diff --git a/src/Toolkit/Toolkit.Maui/BookmarksView/BookmarksView.cs b/src/Toolkit/Toolkit.Maui/BookmarksView/BookmarksView.cs index 84a2ae222..84da265b4 100644 --- a/src/Toolkit/Toolkit.Maui/BookmarksView/BookmarksView.cs +++ b/src/Toolkit/Toolkit.Maui/BookmarksView/BookmarksView.cs @@ -14,6 +14,7 @@ // * limitations under the License. // ******************************************************************************/ using Esri.ArcGISRuntime.Mapping; +using System.Diagnostics.CodeAnalysis; namespace Esri.ArcGISRuntime.Toolkit.Maui; @@ -29,6 +30,7 @@ public class BookmarksView : TemplatedView private static readonly DataTemplate DefaultDataTemplate; private static readonly ControlTemplate DefaultControlTemplate; + [DynamicDependency(nameof(Bookmark.Name), "Esri.ArcGISRuntime.Mapping.Bookmark", "Esri.ArcGISRuntime")] static BookmarksView() { DefaultDataTemplate = new DataTemplate(() => diff --git a/src/Toolkit/Toolkit.Maui/FloorFilter/FloorFilter.DefaultTemplates.cs b/src/Toolkit/Toolkit.Maui/FloorFilter/FloorFilter.DefaultTemplates.cs index 79d2c13b0..1338a4c60 100644 --- a/src/Toolkit/Toolkit.Maui/FloorFilter/FloorFilter.DefaultTemplates.cs +++ b/src/Toolkit/Toolkit.Maui/FloorFilter/FloorFilter.DefaultTemplates.cs @@ -14,6 +14,9 @@ // * limitations under the License. // ******************************************************************************/ +using Esri.ArcGISRuntime.Mapping.Floor; +using System.Diagnostics.CodeAnalysis; + namespace Esri.ArcGISRuntime.Toolkit.Maui; public partial class FloorFilter @@ -24,6 +27,11 @@ public partial class FloorFilter private static readonly DataTemplate DefaultDifferentiatingFacilityDataTemplate; private static readonly ControlTemplate DefaultControlTemplate; + + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Floor.FloorLevel.ShortName), "Esri.ArcGISRuntime.Mapping.Floor.FloorLevel", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Floor.FloorFacility.Name), "Esri.ArcGISRuntime.Mapping.Floor.FloorFacility", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Floor.FloorFacility.Site), "Esri.ArcGISRuntime.Mapping.Floor.FloorFacility", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Floor.FloorSite.Name), "Esri.ArcGISRuntime.Mapping.Floor.FloorSite", "Esri.ArcGISRuntime")] static FloorFilter() { DefaultLevelDataTemplate = new DataTemplate(() => @@ -113,7 +121,6 @@ static FloorFilter() }; subtitleLabel.SetAppThemeColor(Label.TextColorProperty, Color.FromArgb("#2e2e2e"), Color.FromArgb("#aaa")); subtitleLabel.SetBinding(Label.TextProperty, "Site.Name"); - textStack.Children.Add(titleLabel); textStack.Children.Add(subtitleLabel); Grid.SetRow(titleLabel, 0); diff --git a/src/Toolkit/Toolkit.Maui/Legend/Legend.cs b/src/Toolkit/Toolkit.Maui/Legend/Legend.cs index 009cb5759..0942e2afc 100644 --- a/src/Toolkit/Toolkit.Maui/Legend/Legend.cs +++ b/src/Toolkit/Toolkit.Maui/Legend/Legend.cs @@ -15,6 +15,7 @@ // ******************************************************************************/ using Esri.ArcGISRuntime.Mapping; +using System.Diagnostics.CodeAnalysis; namespace Esri.ArcGISRuntime.Toolkit.Maui; @@ -29,6 +30,11 @@ public class Legend : TemplatedView private static DataTemplate s_DefaultLegendInfoItemTemplate; private static ControlTemplate s_DefaultControlTemplate; + + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Layer.Name), "Esri.ArcGISRuntime.Mapping.Layer", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.ILayerContent.Name), "Esri.ArcGISRuntime.Mapping.ILayerContent", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.LegendInfo.Name), "Esri.ArcGISRuntime.Mapping.LegendInfo", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.LegendInfo.Symbol), "Esri.ArcGISRuntime.Mapping.LegendInfo", "Esri.ArcGISRuntime")] static Legend() { s_DefaultLayerItemTemplate = new DataTemplate(() => diff --git a/src/Toolkit/Toolkit.Maui/OverviewMap/OverviewMap.cs b/src/Toolkit/Toolkit.Maui/OverviewMap/OverviewMap.cs index 5e9235dbb..cafd13861 100644 --- a/src/Toolkit/Toolkit.Maui/OverviewMap/OverviewMap.cs +++ b/src/Toolkit/Toolkit.Maui/OverviewMap/OverviewMap.cs @@ -13,9 +13,11 @@ // * See the License for the specific language governing permissions and // * limitations under the License. // ******************************************************************************/ - + using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.Symbology; +using Microsoft.Maui.Controls.Internals; +using System.Diagnostics.CodeAnalysis; using Map = Esri.ArcGISRuntime.Mapping.Map; namespace Esri.ArcGISRuntime.Toolkit.Maui; @@ -30,24 +32,40 @@ public class OverviewMap : TemplatedView private MapView? _overviewMapView; + + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Map.LoadStatus), "Esri.ArcGISRuntime.Mapping.Map", "Esri.ArcGISRuntime")] static OverviewMap() { - string template = @" - - - - - - - - - "; - DefaultControlTemplate = Microsoft.Maui.Controls.Xaml.Extensions.LoadFromXaml(new ControlTemplate(), template); + DefaultControlTemplate = new ControlTemplate(() => + { + var converter = new Internal.LoadStatusToVisibilityConverter(); + Frame rootFrame = new Frame + { + Padding = new Thickness(1), HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, + CornerRadius = 0, HasShadow = false, BorderColor = Colors.Black, BackgroundColor = Colors.White + }; + Grid root = new Grid(); + MapView mapView = new MapView() + { + IsAttributionTextVisible = false + }; + ActivityIndicator activity = new ActivityIndicator(); + activity.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("Map.LoadStatus", converter: converter, converterParameter: "Loading", source : mapView)); + root.Add(activity); + Label label = new Label() + { + TextColor = Colors.Black, Text = "Map failed to load. Did you forget an API key?" + }; + label.SetBinding(VisualElement.IsVisibleProperty, new Binding("Map.LoadStatus", converter: converter, converterParameter: "FailedToLoad", source: mapView)); + root.Add(label); + mapView.SetBinding(VisualElement.IsVisibleProperty, new Binding("Map.LoadStatus", converter: converter, converterParameter: "Loaded", source: mapView)); + root.Add(mapView); + INameScope nameScope = new NameScope(); + NameScope.SetNameScope(rootFrame, nameScope); + nameScope.RegisterName("PART_MapView", mapView); + rootFrame.Content = root; + return rootFrame; + }); } /// diff --git a/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs b/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs index 4c9508258..325bba19a 100644 --- a/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs +++ b/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs @@ -15,6 +15,7 @@ // ******************************************************************************/ using Esri.ArcGISRuntime.Toolkit.Maui.Primitives; +using System.Diagnostics.CodeAnalysis; namespace Esri.ArcGISRuntime.Toolkit.Maui; @@ -57,8 +58,13 @@ public partial class UtilityNetworkTraceTool private Button? PART_ButtonCancelActivity; #pragma warning restore SA1310, SX1309, SA1306 - private static readonly ControlTemplate DefaultControlTemplate; - + private static readonly ControlTemplate DefaultControlTemplate; + + [DynamicDependency(nameof(Esri.ArcGISRuntime.UtilityNetworks.UtilityTraceFunctionOutput.Function), "Esri.ArcGISRuntime.UtilityNetworks.UtilityTraceFunctionOutput", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.UtilityNetworks.UtilityTraceFunctionOutput.Result), "Esri.ArcGISRuntime.UtilityNetworks.UtilityTraceFunctionOutput", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.UtilityNetworks.UtilityNetworkAttribute.Name), "Esri.ArcGISRuntime.UtilityNetworks.UtilityNetworkAttribute", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.UtilityNetworks.UtilityTraceFunction.FunctionType), "Esri.ArcGISRuntime.UtilityNetworks.UtilityTraceFunction", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.UtilityNetworks.UtilityTraceFunction.NetworkAttribute), "Esri.ArcGISRuntime.UtilityNetworks.UtilityTraceFunction", "Esri.ArcGISRuntime")] static UtilityNetworkTraceTool() { const string backgroundColor = "{AppThemeBinding Dark=#353535, Light=#F8F8F8}"; diff --git a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/AttachmentsPopupElementView.Maui.cs b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/AttachmentsPopupElementView.Maui.cs index 0cee56348..5fb7ffe79 100644 --- a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/AttachmentsPopupElementView.Maui.cs +++ b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/AttachmentsPopupElementView.Maui.cs @@ -20,6 +20,7 @@ using System.Globalization; using System.ComponentModel; using System.Runtime.InteropServices; +using System.Diagnostics.CodeAnalysis; #if WINDOWS using WinRT; #endif @@ -44,6 +45,9 @@ static AttachmentsPopupElementView() DefaultControlTemplate = new ControlTemplate(BuildDefaultTemplate); } + [DynamicDependency(nameof(AttachmentsPopupElement.Title), "Esri.ArcGISRuntime.Mapping.Popups.AttachmentsPopupElement", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(AttachmentsPopupElement.Description),"Esri.ArcGISRuntime.Mapping.Popups.AttachmentsPopupElement", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(AttachmentsPopupElement.Attachments), "Esri.ArcGISRuntime.Mapping.Popups.AttachmentsPopupElement", "Esri.ArcGISRuntime")] private static object BuildDefaultTemplate() { StackLayout root = new StackLayout(); @@ -68,6 +72,12 @@ private static object BuildDefaultTemplate() return root; } + + [DynamicDependency(nameof(AttachmentViewModel.Thumbnail), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel","Esri.ArcGISRuntime")] + [DynamicDependency(nameof(AttachmentViewModel.Name), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(AttachmentViewModel.Size), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(AttachmentViewModel.IsDownloadButtonVisible), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(AttachmentViewModel.IsDownloading), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel", "Esri.ArcGISRuntime")] private static object BuildDefaultItemTemplate() { Grid layout = new Grid(); diff --git a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/AttachmentsPopupElementView.cs b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/AttachmentsPopupElementView.cs index 6f0809526..6263e0773 100644 --- a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/AttachmentsPopupElementView.cs +++ b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/AttachmentsPopupElementView.cs @@ -39,10 +39,6 @@ public AttachmentsPopupElementView() { #if MAUI ControlTemplate = DefaultControlTemplate; - // Ensure bound properties aren't trimmed: - _ = Element?.Title; - _ = Element?.Description; - _ = Element?.Attachments; #else DefaultStyleKey = typeof(AttachmentsPopupElementView); #endif diff --git a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/MediaPopupElementView.Maui.cs b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/MediaPopupElementView.Maui.cs index 8c6918ea4..a1364826e 100644 --- a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/MediaPopupElementView.Maui.cs +++ b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/MediaPopupElementView.Maui.cs @@ -17,6 +17,7 @@ using Microsoft.Maui.Controls.Internals; using Esri.ArcGISRuntime.Mapping.Popups; +using System.Diagnostics.CodeAnalysis; namespace Esri.ArcGISRuntime.Toolkit.Maui.Primitives { @@ -38,6 +39,9 @@ static MediaPopupElementView() DefaultControlTemplate = new ControlTemplate(BuildDefaultTemplate); } + [DynamicDependency(nameof(MediaPopupElement.Title), "Esri.ArcGISRuntime.Mapping.Popups.MediaPopupElement", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(MediaPopupElement.Description), "Esri.ArcGISRuntime.Mapping.Popups.MediaPopupElement", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(MediaPopupElement.Media), "Esri.ArcGISRuntime.Mapping.Popups.MediaPopupElement","Esri.ArcGISRuntime")] private static object BuildDefaultTemplate() { StackLayout root = new StackLayout(); @@ -72,6 +76,8 @@ private static object BuildDefaultTemplate() return root; } + [DynamicDependency(nameof(PopupMedia.Title), "Esri.ArcGISRuntime.Mapping.Popups.PopupMedia", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(PopupMedia.Caption), "Esri.ArcGISRuntime.Mapping.Popups.PopupMedia", "Esri.ArcGISRuntime")] private static object BuildDefaultItemTemplate() { var pm = new PopupMediaView(); diff --git a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/MediaPopupElementView.cs b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/MediaPopupElementView.cs index 6fc7cc7c7..1d088ac9e 100644 --- a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/MediaPopupElementView.cs +++ b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/MediaPopupElementView.cs @@ -33,12 +33,6 @@ public MediaPopupElementView() { #if MAUI ControlTemplate = DefaultControlTemplate; - // Ensure bound properties aren't trimmed: - _ = Element?.Title; - _ = Element?.Description; - var m = Element?.Media?.FirstOrDefault(); - _ = m?.Title; - _ = m?.Caption; #else DefaultStyleKey = typeof(MediaPopupElementView); #endif diff --git a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.Maui.cs b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.Maui.cs index 42d03c3f4..bfb389ab5 100644 --- a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.Maui.cs +++ b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.Maui.cs @@ -18,6 +18,7 @@ using Microsoft.Maui.Controls.Internals; using Esri.ArcGISRuntime.Mapping.Popups; using Esri.ArcGISRuntime.Toolkit.Maui.Primitives; +using System.Diagnostics.CodeAnalysis; namespace Esri.ArcGISRuntime.Toolkit.Maui { @@ -59,6 +60,8 @@ static PopupViewer() DefaultPopupViewerCaptionStyle.Setters.Add(new Setter() { Property = Label.LineBreakModeProperty, Value = LineBreakMode.WordWrap }); } + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Popups.Popup.Title), "Esri.ArcGISRuntime.Mapping.Popups.Popup", "Esri.ArcGISRuntime")] + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Popups.Popup.EvaluatedElements), "Esri.ArcGISRuntime.Mapping.Popups.Popup", "Esri.ArcGISRuntime")] private static object BuildDefaultTemplate() { Grid root = new Grid(); diff --git a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.cs b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.cs index 0be0c49e8..c211e46f2 100644 --- a/src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.cs +++ b/src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.cs @@ -19,6 +19,8 @@ using Esri.ArcGISRuntime.RealTime; using Esri.ArcGISRuntime.Toolkit.Internal; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; + #if MAUI using Esri.ArcGISRuntime.Toolkit.Maui.Primitives; using DependencyObject = Microsoft.Maui.Controls.BindableObject; @@ -76,9 +78,6 @@ public PopupViewer() { #if MAUI ControlTemplate = DefaultControlTemplate; - // Ensure bound properties aren't trimmed: - _ = Popup?.Title; - _ = Popup?.EvaluatedElements; #else DefaultStyleKey = typeof(PopupViewer); #endif @@ -98,7 +97,8 @@ public override void OnApplyTemplate() private bool _isDirty = false; private object _isDirtyLock = new object(); - private void InvalidatePopup() + [DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Popups.Popup.EvaluatedElements), "Esri.ArcGISRuntime.Mapping.Popups.Popup", "Esri.ArcGISRuntime")] + private void InvalidatePopup() { lock (_isDirtyLock) {