<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Drag and Drop from ListBox onto Map in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172825#M8122</link>
    <description>&lt;P&gt;The ThemeLayer class contains already the GetItemInfoValue() method, but&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public virtual ItemInfoValue GetItemInfoValue()
        {
            string uri = Id;
            Item portalItem = ItemFactory.Instance.Create(uri, ItemFactory.ItemType.PortalItem);
            
            return new ItemInfoValue()
            {
                name = portalItem?.Name,
                title = portalItem?.Name,
                catalogPath = portalItem?.Path,
                type = portalItem?.Type,
                typeID = portalItem?.TypeID,
                isContainer = "false" // is that correct?
            };
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returned always null, as long as I was giving the url to the portal item, instead of simply handing the item id over.&lt;/P&gt;&lt;P&gt;However, now my issue is that the items path value is not pointing at the service itself but at a directory, via the Rest api: "&lt;A href="https://portal.com/fed/rest/services/folder/service_name/FeatureServer" target="_blank" rel="noopener"&gt;https://portal.com/fed/rest/services/folder/service_name/FeatureServer&lt;/A&gt;".&lt;/P&gt;&lt;P&gt;As I see it the actual Feature Service would be found at : "&lt;A href="https://portal.com/fed/rest/services/folder/service_name/FeatureServer" target="_blank" rel="noopener"&gt;https://portal.com/fed/rest/services/folder/service_name/FeatureServer&lt;/A&gt;&lt;STRONG&gt;/0&lt;/STRONG&gt;". Now, that one I cannot access, since:&lt;/P&gt;&lt;TABLE width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ArcGIS REST Framework&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;Home&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Error: &lt;/STRONG&gt;The administrator has disabled the Services Directory.&lt;BR /&gt;&lt;STRONG&gt;Code: &lt;/STRONG&gt;403&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Usually, I create the layer I want to add from our portal by creating the uriString through:&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string curService = $"https://portal.com/portal/home/item.html?id={guid}"
LayerFactory.Instance.CreateLayer(new Uri(curService, UriKind.Absolute), activeMapView.Map, 0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and that's what I planned to have in the OnDrop() method. But, I never reach the method, because the end of the StartDrag() method leads to a warning-messagebox: Add data - Failed to add data: &lt;A href="https://portal.com/fed/rest/services/folder/service_name/FeatureServer" target="_blank" rel="noopener"&gt;https://portal.com/fed/rest/services/folder/service_name/FeatureServer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I would rather have the OnDrop() method doing the job of adding the items to the map. Currently it seems that the StartDrag() method is doing everything, which does not make sense, since it is immediately activated when dragging something, without even knowing where it is dragged to.&lt;/P&gt;&lt;P&gt;Does that make sense?&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2022 14:34:34 GMT</pubDate>
    <dc:creator>TomGeo</dc:creator>
    <dc:date>2022-05-11T14:34:34Z</dc:date>
    <item>
      <title>Drag and Drop from ListBox onto Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172331#M8110</link>
      <description>&lt;P&gt;I have a ListBox in a Dockpane from where I want to Drag/Drop items onto a Map. When starting the Drag the StartDrag method is triggered. However, neither OnDragOver or OnDrop is ever triggered thereafter.&lt;/P&gt;&lt;P&gt;My XAML file has a reference to the DragDrop namespace and the ListBox is set as drag source&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;xmlns:dragDrop="clr-namespace:ArcGIS.Desktop.Framework.DragDrop;assembly=ArcGIS.Desktop.Framework"
&amp;lt;ListBox x:Name="DataLayerList" ItemsSource="{Binding LayersFiltered, Mode=TwoWay}" dragDrop:DragDrop.IsDragSource="True" dragDrop:DragDrop.DragHandler="{Binding}"/&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My ViewModel implements IDragSource and here is my Drag&amp;amp;Drop part. Where OnDragOver and OnDrop is never triggered when I pull an item from the ListBox onto a Map.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private List&amp;lt;string&amp;gt; _dragLayerGuids;

public void StartDrag(DragInfo dragInfo)
{
    IEnumerable sourceItems = dragInfo.SourceItems;
    if (sourceItems == null)
    {
        return;
    }

    _dragLayerGuids = new List&amp;lt;string&amp;gt;();
    foreach (ThemeLayer layer in sourceItems)
    {
        _dragLayerGuids.Add(layer.Id);
    }
}

public override void OnDragOver(DropInfo dropInfo)
    {
        dropInfo.Effects = DragDropEffects.All;
    }

public override void OnDrop(DropInfo dropInfo)
{
    if (_dragLayerGuids != null)
    {
        AddService(_dragLayerGuids);
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing to make this work?&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 09:39:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172331#M8110</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2022-05-10T09:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Drag and Drop from ListBox onto Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172415#M8114</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have you tried Esri community sample&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/DragAndDrop" target="_self"&gt;Drag And Drop&lt;/A&gt;&amp;nbsp;. There is a part where FGDB featureclass drags to map.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 14:10:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172415#M8114</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-05-10T14:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Drag and Drop from ListBox onto Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172429#M8115</link>
      <description>&lt;P&gt;Yes, I worked with both examples, the one you mentioned and the one for the Excel file drop.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 14:34:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172429#M8115</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2022-05-10T14:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Drag and Drop from ListBox onto Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172518#M8117</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Your ThemeLayer must have method:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;		public virtual ItemInfoValue GetItemInfoValue()&lt;/LI-CODE&gt;&lt;P&gt;Your StartDrag method must be like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;			List&amp;lt;ClipboardItem&amp;gt; clip_items = new List&amp;lt;ClipboardItem&amp;gt;();
			foreach (ThemeLayer layer in sourceItems)
			{
				clip_items.Add(new ClipboardItem()
				{
					ItemInfoValue = layer.GetItemInfoValue()
				});
			}
			dragInfo.Data = clip_items;
			dragInfo.Effects = DragDropEffects.Copy;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 10 May 2022 18:11:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172518#M8117</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-05-10T18:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Drag and Drop from ListBox onto Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172825#M8122</link>
      <description>&lt;P&gt;The ThemeLayer class contains already the GetItemInfoValue() method, but&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public virtual ItemInfoValue GetItemInfoValue()
        {
            string uri = Id;
            Item portalItem = ItemFactory.Instance.Create(uri, ItemFactory.ItemType.PortalItem);
            
            return new ItemInfoValue()
            {
                name = portalItem?.Name,
                title = portalItem?.Name,
                catalogPath = portalItem?.Path,
                type = portalItem?.Type,
                typeID = portalItem?.TypeID,
                isContainer = "false" // is that correct?
            };
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returned always null, as long as I was giving the url to the portal item, instead of simply handing the item id over.&lt;/P&gt;&lt;P&gt;However, now my issue is that the items path value is not pointing at the service itself but at a directory, via the Rest api: "&lt;A href="https://portal.com/fed/rest/services/folder/service_name/FeatureServer" target="_blank" rel="noopener"&gt;https://portal.com/fed/rest/services/folder/service_name/FeatureServer&lt;/A&gt;".&lt;/P&gt;&lt;P&gt;As I see it the actual Feature Service would be found at : "&lt;A href="https://portal.com/fed/rest/services/folder/service_name/FeatureServer" target="_blank" rel="noopener"&gt;https://portal.com/fed/rest/services/folder/service_name/FeatureServer&lt;/A&gt;&lt;STRONG&gt;/0&lt;/STRONG&gt;". Now, that one I cannot access, since:&lt;/P&gt;&lt;TABLE width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ArcGIS REST Framework&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;Home&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Error: &lt;/STRONG&gt;The administrator has disabled the Services Directory.&lt;BR /&gt;&lt;STRONG&gt;Code: &lt;/STRONG&gt;403&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Usually, I create the layer I want to add from our portal by creating the uriString through:&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string curService = $"https://portal.com/portal/home/item.html?id={guid}"
LayerFactory.Instance.CreateLayer(new Uri(curService, UriKind.Absolute), activeMapView.Map, 0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and that's what I planned to have in the OnDrop() method. But, I never reach the method, because the end of the StartDrag() method leads to a warning-messagebox: Add data - Failed to add data: &lt;A href="https://portal.com/fed/rest/services/folder/service_name/FeatureServer" target="_blank" rel="noopener"&gt;https://portal.com/fed/rest/services/folder/service_name/FeatureServer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I would rather have the OnDrop() method doing the job of adding the items to the map. Currently it seems that the StartDrag() method is doing everything, which does not make sense, since it is immediately activated when dragging something, without even knowing where it is dragged to.&lt;/P&gt;&lt;P&gt;Does that make sense?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 14:34:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/drag-and-drop-from-listbox-onto-map/m-p/1172825#M8122</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2022-05-11T14:34:34Z</dc:date>
    </item>
  </channel>
</rss>

