Closed TimPurdum closed 2 years ago
Based on discussions with @seahro and @morehavoc , here are some steps for implementation.
buildDotNetListItem(item: ListItem)
that converts an arcgis ListItem
to something that the C# json parser can handle.layerListWidget.listItemCreatedFunction
to a new anonymous function, e.g. layerListWidget.listItemCreatedFunction = (evt) => { };
ListItem
in C#.OnLayerListSelectResult
and OnLayerListSelectResultHandler
to OnListItemSelected
and OnListItemSelectedHandler
in LayerListWidget.cs
.listItemCreatedFunction
to something like widget.DotNetObjectReference.InvokeAsync<DotNetListItem>('OnListItemSelected
, dotNetListItem)to return the
DotNetListItem` back. Verify that the data is getting set in C#.LayerListWidget.cs
, change the event handler to public Func<ListItem, Task<ListItem>>? OnListItemSelectedHandler {get; set;}
.[JSInvokable]
method LayerListWidget.OnListItemSelected(ListItem item)
, do return OnListItemSelectedHandler?.Invoke(item)
.LayerLists.razor
that has multiple layers, and implements a method for OnListItemSelected
.I'm sure that we will hit more snags along the way, but this should hopefully add a bit more guidance.
ArcGIS API for JavaSript - LayerList
switch
statement in thearcGisJsInterop.ts
functionaddWidget()
to handle theLayerList
widget type. This should set the following values (if set in C#):iconClass
(string)label
(string)view
- this should be set to the view found at the top ofaddWidget()
listItemCreatedFunction
event. Use theSearch
widget as an example.LayerListViewModel
abilities later....Core\Components\Widgets\LayerListWidget.cs
that inherits fromWidget.cs
, and haspublic string? IconClass
andpublic string? Label
with the[Parameter]
and[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
attributes.ListItemCreated
event handler toLayerList.Widget.cs
, again usingSearchWidget.cs
as a template.