|
POST
|
Your finding is correct ContextMenuDataContext is null for the Can method for DelegateCommands. I will check with the development team on this issue. However, if you intend to use this function to control visibility of your menu button i would recommend to use a condition instead. When i duplicated your issue i was only interested in showing the context menu button when a feature layer has been selected. So i added the esri_mapping_featureLayerSelectedCondition condition to my button: <controls>
<!-- add your controls here -->
<button id="TestContextMenu_LayerContextMenu_Items_Button1" caption="Show Selected FLyr Name"
className="TestContextMenu_Module:OnMenuButtonClick" loadOnClick="true" keytip="B1"
condition="esri_mapping_featureLayerSelectedCondition"
smallImage="Images/GenericButtonGreen16.png"
largeImage="Images/GenericButtonGreen32.png">
<tooltip heading="Menu Button 1">ToolTip<disabledText /></tooltip>
</button>
</controls> And now the context menu honors the state of condition i added: Below is the context menu when a feature layer has been selected: and here is context menu when a raster layer has been selected: You can find more conditions here: https://github.com/Esri/arcgis-pro-sdk/wiki/DAML-ID-Reference-ADMapping.daml#conditions
... View more
04-17-2020
03:39 PM
|
1
|
0
|
1776
|
|
POST
|
When you implement a dockpane using the Pro SDK it supports MVVM (Model - View - ViewModel) out of box. You can check out this video (starting at minute 20:00 of the video) to get an overview of MVVM in the Pro SDK: https://www.youtube.com/watch?v=5PgaeZycWXc What this means is that the Pro SDK Item Template for DockPanes creates multiple files in support of MVVM for you. These files are used for: The View (or UI): Dockpane1.xaml (and included with the XAML is the usually hidden Dockpane1.cs file containing the partial class implementation of the Dockpane1View / UserControl class). If you make any changes to the View you ONLY make these changes in XAML. You would not make any changes in the code behind for the View (Dockpane1View.cs file) when you are coding using the MVVM programming pattern . The ViewModel (or business logic, code behind): Dockpane1ViewModel.cs contains the actual business logic and the properties to exchange data at runtime with the View using data binding. In MVVM this is were all code (business logic) goes, including the properties (which must be public) that are 'data bound' to the View (UI implemented in XAML) Looking at your code snippet I see that you mixed MVVM with a non MVVM pattern. To implemented a command using the MVVM pattern, you have to utilize what is known as the ICommand pattern. There a plenty of examples under the Pro SDK community sample github repo, but you can search for BrowseCommand in the UploadItem sample and you find the XAML implementation here: arcgis-pro-sdk-community-samples/UploadItem.xaml at f5f9dda18efa173a56d128f3ea64ca34ac3f68a9 · Esri/arcgis-pro-sdk-commu… and the business logic for the BrowseCommand button is here: arcgis-pro-sdk-community-samples/UploadItemViewModel.cs at f5f9dda18efa173a56d128f3ea64ca34ac3f68a9 · Esri/arcgis-pro-sd…
... View more
04-16-2020
04:22 PM
|
1
|
4
|
4236
|
|
POST
|
This could be the problem: when you change your custom settings make sure you set the Project to reflect a dirty status with: Project.Current.SetDirty (true);
... View more
04-15-2020
09:27 AM
|
1
|
0
|
1383
|
|
POST
|
Ok, that makes sense now. Yes, this will be a problem. Besides running your work on an asynchronous thread, QueuedTask.Run is also used to manage the ArcGIS Pro state, meaning that tasks like drawing, selection, geometry, and apparently cursor operations are 'serialized' and executed in a certain sequence. So if you execute a modal dialog from within such an operation you in effect 'block' the next QueuedTask.Run task, which in your case is the flashing of the geometry from within your dialog. You can bring up the ArcGIS Pro Diagnostic Monitor using the (Alt + Ctrl + M keys from within ArcGIS Pro) to view the health of ArcGIS Pro's threads. In order to get this to work properly you have to change your workflow a bit. In your rowcursor you have to fill a collection of object ids, geometries (make sure to clone), etc. (collect whatever you need for your business logic) and once the collection is complete (you are done with queuedtask.run and back on the UI thread) you can then use that collection to process your records one by one. Flashing of geometries, updating of records, etc. should work unhindered. I have used this in the past especially for bulk updates or deletes.
... View more
04-14-2020
10:40 AM
|
0
|
1
|
2505
|
|
POST
|
I tried the Mvvm version of ProWindow as well and was not able to duplicate the issue you reported. i am using 2.5 of the Pro SDK.
... View more
04-13-2020
04:01 PM
|
0
|
3
|
2505
|
|
POST
|
I tried this using a Modal ProWindow and didn't experience the hang: and the selected polygon is flashed as expected, using the code snippet below. try
{
var oid = long.Parse(ObjectId.Text);
var layerName = FeatureLayerName.Text;
var lineLayer = MapView.Active.Map.GetLayersAsFlattenedList()
.OfType<FeatureLayer>()
.Where(lyr =>
lyr.Name == layerName).FirstOrDefault() as FeatureLayer;
await QueuedTask.Run(() =>
{
MapView.Active.FlashFeature(lineLayer, oid);
});
}
catch (Exception ex)
{
MessageBox.Show($@"Exception: {ex.Message}");
} I will try MVVM next, but i can't imagine that this makes a difference. Try surrounding your code with a try ... catch ... just in case there's issues with code itself.
... View more
04-13-2020
02:28 PM
|
0
|
0
|
2505
|
|
POST
|
I used the following snippet to check if a column value of a Row is null: foreach (var field in fields)
{
var val = row[field.Name];
if (val is DBNull || val == null) continue;
...
} the code is used in this sample: https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/2d6a30e2597c7a0079ae65b182f60a77e79aaef7/Map-Exploration/CustomPopup/CustomPopupTool.cs The sample has to ignore null columns.
... View more
04-10-2020
09:13 AM
|
0
|
0
|
2138
|
|
POST
|
Hi Marvis, I added a sample showing how to implement a modal ProWindows dialog. https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/ProWindowMVVM
... View more
04-09-2020
12:23 PM
|
3
|
1
|
6212
|
|
POST
|
I duplicated the problem you were seeing. The property is not showing the correct value, which should be OSA and DBMS. I tested in the current alpha version of 2.6 and it's a bug in that version as well. I reported to issue to the GeoDatabase team. I will give an update if i hear of a fix or workaround. Thanks, Wolf
... View more
04-08-2020
10:31 AM
|
0
|
4
|
3360
|
|
POST
|
I posted a new sample that illustrates a 'draping' on ground surface solution for polygons: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/OverlayGroundSurface
... View more
04-07-2020
10:10 AM
|
0
|
0
|
5344
|
|
POST
|
Hi Marvis, You need to add a ProWindow (via the ArcGIS Pro SDK item templates) to your add-in. By default the ProWindow you add to your project will not be MVVM, but you can use the newly created ProWindow like any out-of-box WPF window. You can find an example of such a ProWindow in community samples here: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/f5f9dda18efa173a56d128f3ea64ca34ac3f68a9/Framework/CustomCategories/UI Then you can use the following snippet to instantiate the ProWindow for the Report Categories sample linked above as follows: internal class ShowReports : Button
{
private UI.ReportsWindow _reportsWnd = null;
protected override void OnClick()
{
//already open?
if (_reportsWnd != null)
return;
_reportsWnd = new UI.ReportsWindow();
_reportsWnd.Owner = FrameworkApplication.Current.MainWindow;
_reportsWnd.Closed += (o,e) => { _reportsWnd = null; };
_reportsWnd.ShowDialog();
}
} One problem is that the ShowDialog() method is in an internal namespace but Visual Studio should be able to locate the method via intellisense. This is a bug that we will fix as soon as possible. This is also the reason why ShowDialog doesn't show up in the Pro SDK API help documentation. ShowDialog returns true if you set the DialogResult property to true before calling Close() on the ProWindow. Let me know if you have any questions or if you need of a MVVM sample. - Wolf
... View more
04-06-2020
04:32 PM
|
0
|
3
|
6212
|
|
POST
|
Hi Justin, i managed to get the 'draping' of polygons to work as well, however, i ran into a few issues. I will try to publish my sample on ArcGIS Pro SDK Community Samples tomorrow, but in essence the algorithm works like this: i take the polygon to create a 'fishnet mesh' from which i then create a [triangle] MultiPatch geometry. Finally I pass the MultiPatch geometry to GetZsFromSurfaceAsync in order to get the elevation for all MultiPatch nodes set to the proper elevation value. Quite some work for a workaround, but the result looks like this:
... View more
03-30-2020
04:34 PM
|
1
|
0
|
5344
|
|
POST
|
Hi Justin, I managed to get points and lines to work so far. Points are straight forward (just call GetZsFromSurfaceAsync using the point geometry), but for lines, the trick for the workaround is to 'densify' the polyline before you pass the geometry to GetZsFromSurfaceAsync. This way each vertex will be elevated to the proper Z value. Below is the snippet i used in my test tool: protected async override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
var polyline = geometry as Polyline;
if (polyline != null)
{
var sR = polyline.SpatialReference;
// make more vertices ... using tolerance to cover projected / non-projected coord systems
var denseDistance = sR.XYTolerance * 1000;
var denseLine = GeometryEngine.Instance.DensifyByLength(polyline, denseDistance) as Polyline;
var result = await ActiveMapView.Map.GetZsFromSurfaceAsync(denseLine);
if (result.Status == SurfaceZsResultStatus.Ok)
{
_ = QueuedTask.Run(() =>
{
var movedZup = GeometryEngine.Instance.Move(result.Geometry, 0, 0, 1) as Polyline;
ActiveMapView.AddOverlay(Module1.MakeCIMLineGraphic(movedZup));
});
}
}
return true;
}
Depending on the resolution of your surface you might have to elevate the line above the surface because Pro might obscure parts of the lines when you zoom out. Below is a screenshot of my test where i placed first two points (the Pushpins) and then a line between those two points (i only digitized the start & end points): As i mentioned above once you zoom in the line will not be obscured any more. Below a screen shot of the line's left end viewed from the opposite side: i haven't figured out the polygon 'draping' yet, but i will finish that and the sample next week. - Wolf
... View more
03-27-2020
04:42 PM
|
1
|
0
|
5344
|
|
POST
|
Hi Justin, I think Uma is correct as there is no direct method to do this, however, you can look at this method: GetZsFromSurfaceAsync as a workaround. This method takes your geometry and sets the Z values to elevation surface Zs. You can then add the output 3D geometry to as an overlay graphic. I will add a sample to community samples that will do this. Hopefully later today... - Wolf
... View more
03-27-2020
08:52 AM
|
1
|
0
|
5344
|
|
POST
|
Hi Karsten, I tried the following code which seemed to work fine. In essence i subscribe to the Project Closing event in my module class and execute your MessageBox logic in the subscription method. First i changed the autoLocad property in the insertModule tag in my config.daml to true: <modules>
<insertModule id="ProjClosing_Module" className="Module1"
autoLoad="true" caption="Module1">
....
</insertModule>
</modules> This will ensure that my add-in is initialized regardless of any UI interactions. In the Module's Initialize override i subscribe to the Project Closing event, and in OnProjectClosing i do the customization including the MessageBox. protected override bool Initialize()
{
ArcGIS.Desktop.Core.Events.ProjectClosingEvent.Subscribe(OnProjectClosing);
return base.Initialize();
}
/// <summary>
/// Event handler for ProjectClosing event.
/// </summary>
/// <param name="args">The ProjectClosing arguments.</param>
/// <returns></returns>
private Task OnProjectClosing(ArcGIS.Desktop.Core.Events.ProjectClosingEventArgs args)
{
// if already canceled, ignore
if (args.Cancel)
return Task.CompletedTask;
var targetProjFolder = @"c:\temp";
var result = MessageBox.Show($@"Soll das aktuelle Projekt in ein anderes Verzeichnis als {targetProjFolder} kopiert werden ?", "Projekt sichern", System.Windows.MessageBoxButton.YesNoCancel, System.Windows.MessageBoxImage.Question);
return Task.CompletedTask;
} the Project closing messagebox doesn't show up until after i answer the popup messagebox. Hope this helps, Wolf
... View more
03-26-2020
03:27 PM
|
1
|
0
|
2900
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-29-2025 10:48 AM | |
| 1 | 05-24-2021 09:04 AM | |
| 1 | 12-03-2020 08:44 AM | |
| 1 | 10-07-2025 07:27 AM | |
| 2 | 12-29-2025 10:03 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-21-2026
01:59 PM
|