|
POST
|
Hi David, I see this problem now too. Upon investigation - Images referenced using the Pack URI will display only when the dll is loaded and in memory. In this case, the dll is not loaded and hence the resource dictionary that Pro has in memory does not contain your image. There are 2 ways (probably more) to get this to work - 1. Create a class in your resource dll that you instantiate in your add-in's module class. This will load the resource dll when the add-in is loaded, which will allow the image to be displayed. 2. In your module class's initialize override, load the resource assembly using the code snippet below. // In Add-in's module class:
protected override bool Initialize()
{
Load();
return base.Initialize();
}
private void Load()
{
string assemblyName = "ResourceDllWithUserControl";
string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string assemblyPath = Path.Combine(folderPath, string.Format("{0}.dll", new AssemblyName(assemblyName).Name));
Assembly assembly = Assembly.LoadFrom(assemblyPath);
} Thanks Uma
... View more
09-20-2019
02:53 PM
|
2
|
1
|
2215
|
|
POST
|
Hi David, When Pro load's your add-ins (which have references to images in other dlls) - Pro needs to know where these dlls are. Here are two scenarios: 1. If the referenced dll with the images is another add-in, you could set that add-in's autoload attribute (located in the config.daml) to true. This way, when your add-in loads, the add-in with the images will also load, thus resolving the image source uris. 2. If the referenced dll with the images is a resource dll (not an add-in), then when you reference it from your add-in, set its "Copy Local" attribute to true. So when your add-in loads, the dll with the images will also be extracted to Pro's assembly Cache, thus resolving the image source uris at runtime. Thanks Uma
... View more
09-19-2019
02:37 PM
|
2
|
3
|
2215
|
|
POST
|
Hi Max, The start page displayed by your configuration is shown at Application startup and cannot be displayed again. One idea is to re-use your start page user control and display it from a tab button (OnClick override of the button) in Pro's backstage. Thanks Uma
... View more
09-18-2019
11:29 AM
|
0
|
1
|
893
|
|
POST
|
Hi Jibrahn This issue was reported by another customer at 2.3 and has now been fixed in ArcGIS Pro 2.4 on wards. I was able to test and confirm this. Also, just as an FYI: For faster performance, instead of making the edits to the attribute per row, you could load the Inspector with the map member and OIDs as explained in this snippet: Load map selection into Inspector and Change Attributes Thanks Uma
... View more
09-13-2019
03:26 PM
|
2
|
0
|
1148
|
|
POST
|
Hi Jibrahn If possible can you please send me a code sample and perhaps even a sample dataset so I can reproduce this? I can debug and see what is happening. You can attach zips to your post. Thank you! Uma
... View more
09-13-2019
01:07 PM
|
0
|
2
|
1148
|
|
POST
|
Hi Richard Thank you for the clear explanation on what you are trying to accomplish. I was able to see the issue once I changed my code to use Map overlays. Look like Overlay graphics don't resize with the map reference scale. I will update this post once I have some information as to when this will be implemented. Thanks Uma
... View more
09-11-2019
02:41 PM
|
0
|
1
|
2633
|
|
POST
|
Hi Naresh, ArcGIS Pro Extensions NuGet is available from ArcGIS Pro 2.4 release onward only. If you need to target version 2.1, you will need ArcGIS Pro 2.1. This wiki page has instructions on "manually" configuring a build machine. You could try doing that. Method 2: Manual configuration of build server Thanks Uma
... View more
09-11-2019
08:21 AM
|
3
|
0
|
2110
|
|
POST
|
Hi Mike Here is some code snippet that recursively checks through all the layers (including group layers) to move the layer. In this example the layer I want to move is the "US Cities layer". I want to move this layer to be below US Counties layer. Thanks Uma protected override void OnClick()
{
var layerToMove = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(f => f.Name == "U.S. Cities").FirstOrDefault();
if (layerToMove == null)
{
MessageBox.Show("Layer U.S. Cities not found ");
return;
}
var moveBelowThisLayerName = "U.S. Counties (Generalized)";
//In order to move layerToMove, I need to know if the destination is a group layer and the zero based position it needs to move to.
Tuple<GroupLayer, int> moveToLayerPosition = FindLayerPosition(null, moveBelowThisLayerName);
if (moveToLayerPosition.Item2 == -1) {
MessageBox.Show($"Layer {moveBelowThisLayerName} not found ");
return;
}
QueuedTask.Run( () => {
if (moveToLayerPosition.Item1 != null) //layer gets moved into the group
moveToLayerPosition.Item1.MoveLayer(layerToMove, moveToLayerPosition.Item2);
else //Layer gets moved into the root
MapView.Active.Map.MoveLayer(layerToMove, moveToLayerPosition.Item2);
});
}
private Tuple<GroupLayer, int> FindLayerPosition(GroupLayer groupLayer, string moveToLayerNameBelow)
{
int index = 0;
foreach (var lyr in groupLayer != null? groupLayer.Layers : MapView.Active.Map.Layers)
{
index++;
if (lyr is GroupLayer)
{
//We descend into a group layer and search all the layers within.
var result = FindLayerPosition(lyr as GroupLayer, moveToLayerNameBelow);
if (result.Item2 >= 0)
return result;
continue;
}
if (moveToLayerNameBelow == lyr.Name) //We have a match
{
return new Tuple<GroupLayer, int>(groupLayer, index);
}
}
return new Tuple<GroupLayer, int>(null, -1);
}
... View more
09-10-2019
04:32 PM
|
3
|
1
|
3012
|
|
POST
|
Hi Susan, In your new layer, to remove fields from the underlying feature class in the geodatabase, you have to use the Delete Field geoprocessing tool. Thank you! Uma
... View more
09-09-2019
02:42 PM
|
0
|
0
|
2359
|
|
POST
|
Hi Mike One way to do this is - Get the "Layers" collection from the Map using the Layers property. This will give you the collection of layers in that map You can then iterate through this to get the layer you want to move your layer next to. (Using the MoveLayer method ) Things to note: You have to check if the layer is a "Group Layer" in the collection of Layers returned. If it is a Group Layer, you have to iterate through this collection. Index of the layer is relative to the parent. So within the Group Layer, the index will be relative to the parent group. Thanks Uma
... View more
09-09-2019
11:19 AM
|
1
|
3
|
3012
|
|
POST
|
Hi Sam, One way you can do this - In your Module class' Initialize override, you can subscribe to an event such as the ProjectOpenedEvent. The event handler can set your custom state. This way when a project opens, your states will get evaluated immediately.
... View more
09-05-2019
11:15 AM
|
0
|
2
|
1798
|
|
POST
|
Hi Sam By default, an add-in's module is set to be loaded just-in-time (JIT). So when Pro application loads, your logic to enable the button is not invoked yet. You can change this by modifying the "autoload" attribute in the config.daml - Set this to false. <modules>
<insertModule id="acme_mainModule" caption="Acme"
className="MainModule" autoLoad="false">
<!--Declare additional customizations here..-->
</insertModule>
</modules> Thanks Uma
... View more
09-05-2019
10:32 AM
|
0
|
4
|
1798
|
|
POST
|
Hi Susan You could use the LayerFactory's CopyLayer method. var lyrToCopy = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
await QueuedTask.Run(
() => {
if (LayerFactory.Instance.CanCopyLayer(lyrToCopy))
LayerFactory.Instance.CopyLayer(lyrToCopy, MapView.Active.Map);
}); Thanks Uma
... View more
09-05-2019
10:01 AM
|
2
|
2
|
2359
|
|
POST
|
Hi Sai, Than, It is not possible to display just a subset of the coordinate systems in the Coordinate system picker control. Thanks Uma
... View more
09-05-2019
08:24 AM
|
1
|
2
|
2223
|
|
POST
|
Hi Dragging from Contents pane is not yet supported using the public API. It will be available with 2.5 that is scheduled to be released in Jan 2020. In the meantime, the code below will work but it uses some internal namespaces. Extension methods: using ArcGIS.Desktop.Framework.DragDrop;
using ArcGIS.Desktop.Internal.Mapping.TOC;//note the “Internal”
using ArcGIS.Desktop.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DragAndDrop.Helpers
{
public static class DragDropExtensions
{
public static bool HasTOCContent(this DropInfo dropInfo)
{
return dropInfo?.Data is TOCDragPayload; //This class is in an internal namespace
}
public static List<MapMember> GetTOCContent(this DropInfo dropInfo)
{
if (!HasTOCContent(dropInfo))
return new List<MapMember>();
var tocPayload = dropInfo.Data as TOCDragPayload;
//get the content
return tocPayload.ViewModels.Select(vm => vm.Model).OfType<MapMember>()?.ToList() ?? new List<MapMember>();
}
public static List<T> GetTOCContentOfType<T>(this DropInfo dropInfo) where T: MapMember
{
return GetTOCContent(dropInfo).OfType<T>()?.ToList() ?? new List<T>();
}
public static string GetMapUri(this DropInfo dropInfo)
{
return HasTOCContent(dropInfo) ? ((TOCDragPayload)dropInfo.Data).SourceMapURI : string.Empty;
}
}
}
Usage: public override async void OnDrop(DropInfo dropInfo)
{
if (dropInfo.HasTOCContent())//extension method
{
var mm = dropInfo.GetTOCContent();//extension method - returns all MapMembers being dropped
//get just feature layers, for example
var layers = dropInfo.GetTOCContentOfType<FeatureLayer>(); //extension method
//which, honestly, is the same as doing this...so take your pick...
var layers2 = mm.OfType<FeatureLayer>()?.ToList() ?? new List<FeatureLayer>();
//and then ditto for StandaloneTable, ElevationSurface, LabelClass, etc.
//last, get the source map to which the map members belong
var mapuri = dropInfo.GetMapUri();
//99 times out of a 100 this will be the active view map....
//but, if not, get the actual map (or scene) this way
var map = FrameworkApplication.Panes.OfType<IMapPane>()?.Select(mp => mp.MapView.Map)
.Where(m => m.URI == mapuri).First();
}
Thanks Uma
... View more
09-04-2019
10:47 AM
|
0
|
0
|
3571
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-18-2025 03:09 PM | |
| 1 | 11-04-2025 08:25 AM | |
| 1 | 09-23-2025 09:31 AM | |
| 1 | 11-20-2024 10:50 AM | |
| 1 | 04-28-2025 03:06 PM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|