Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into v.next
Browse files Browse the repository at this point in the history
  • Loading branch information
Morten Nielsen committed Nov 29, 2023
2 parents 8649c28 + e0e8c3d commit 008db07
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/Toolkit/Toolkit.Maui/BookmarksView/BookmarksView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// * limitations under the License.
// ******************************************************************************/
using Esri.ArcGISRuntime.Mapping;
using System.Diagnostics.CodeAnalysis;

namespace Esri.ArcGISRuntime.Toolkit.Maui;

Expand All @@ -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(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(() =>
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/Toolkit/Toolkit.Maui/Legend/Legend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// ******************************************************************************/

using Esri.ArcGISRuntime.Mapping;
using System.Diagnostics.CodeAnalysis;

namespace Esri.ArcGISRuntime.Toolkit.Maui;

Expand All @@ -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(() =>
Expand Down
52 changes: 35 additions & 17 deletions src/Toolkit/Toolkit.Maui/OverviewMap/OverviewMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = @"<ControlTemplate xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
xmlns:esri=""clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui""
xmlns:internal=""clr-namespace:Esri.ArcGISRuntime.Toolkit.Maui.Internal;assembly=Esri.ArcGISRuntime.Toolkit.Maui"">
<Frame Padding=""1"" HorizontalOptions=""FillAndExpand"" VerticalOptions=""FillAndExpand"" CornerRadius=""0"" HasShadow=""False"" BorderColor=""Black"" BackgroundColor=""White"">
<Grid>
<Grid.Resources>
<internal:LoadStatusToVisibilityConverter x:Key=""LoadStatusToVisibilityConverter"" />
</Grid.Resources>
<ActivityIndicator IsRunning=""{Binding Source={x:Reference PART_MapView}, Path=Map.LoadStatus, Converter={StaticResource LoadStatusToVisibilityConverter}, ConverterParameter='Loading'}"" />
<Label TextColor=""Black"" Text=""Map failed to load. Did you forget an API key?"" IsVisible=""{Binding Source={x:Reference PART_MapView}, Path=Map.LoadStatus, Converter={StaticResource LoadStatusToVisibilityConverter}, ConverterParameter='FailedToLoad'}"" />
<esri:MapView x:Name=""PART_MapView"" IsAttributionTextVisible=""False"" IsVisible=""{Binding Source={x:Reference PART_MapView}, Path=Map.LoadStatus, Converter={StaticResource LoadStatusToVisibilityConverter}, ConverterParameter='Loaded'}"" />
</Grid>
</Frame>
</ControlTemplate>";
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;
});
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// ******************************************************************************/

using Esri.ArcGISRuntime.Toolkit.Maui.Primitives;
using System.Diagnostics.CodeAnalysis;

namespace Esri.ArcGISRuntime.Toolkit.Maui;

Expand Down Expand Up @@ -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}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Globalization;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
#if WINDOWS
using WinRT;
#endif
Expand All @@ -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();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

using Microsoft.Maui.Controls.Internals;
using Esri.ArcGISRuntime.Mapping.Popups;
using System.Diagnostics.CodeAnalysis;

namespace Esri.ArcGISRuntime.Toolkit.Maui.Primitives
{
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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)
{
Expand Down

0 comments on commit 008db07

Please sign in to comment.