Custom spatial references in the coordinate system control

1428
10
03-03-2020 02:18 PM
JeffBoyton
New Contributor II

The ArcGIS.Desktop.Mapping.Controls.CoordinateSystemsControl which we were advised to use to select coordinate systems allows the user to create a custom coordinate system that they must then add to the map or add to their favorites. If the user adds their custom coordinate system to favorites and selects it, this control does not return it as the SelectedSpatialReference as it should.  If the user reopens this control with favorites already in the list, this control also does not return them nor does the SelectedSpatialReferenceChanged event get triggered when they are selected.  Is this a bug?

0 Kudos
10 Replies
NarelleChedzey
Esri Contributor

Hi Jeff, 

Yes I can confirm that there are bugs with this control when using custom spatial references.  One in that the event does not fire when a custom spatial reference is selected.  There is also another problem in that custom spatial references are not always displayed correctly when there are multiple items in the Favorites  (they seem to display an incorrect name in the dialog, however selecting them and clicking the Details hyperlink shows the correct information).

Thanks for letting us know about these issues.  I will add bugs to our system and will look at getting them fixed for ArcGIS Pro 2.6.

Narelle

0 Kudos
JeffBoyton
New Contributor II

Thanks for the quick reply.  I am looking forward to fixes for this as the control is pretty useless for custom coordinate systems as it is.

0 Kudos
AbelPerez
Occasional Contributor III

Jeff Boyton‌ can you share how you added the CoordinateSystemsControl to your project? I'm looking everywhere for it but cant seem to find it to add to my References.

0 Kudos
JeffBoyton
New Contributor II

...

xmlns:mapping="clr-namespace:ArcGIS.Desktop.Mapping.Controls;assembly=ArcGIS.Desktop.Mapping"

...


<mapping:CoordinateSystemsControl Grid.Row="0"
                                                               x:Name="CoordinateSystemsControl"
                                                               ConfigureControl="{Binding Path=ControlProperties}" />

0 Kudos
AbelPerez
Occasional Contributor III

Jeff Boyton‌ thanks for the tip. I'm fairly new to WPF but am ramping up quick. So you put the reference on a DockPane? if you have any examples or know of any links I could take a look at, I would very much appreciate it. 

0 Kudos
UmaHarano
Esri Regular Contributor

Abel,

Not sure if you have seen this sample - CoordinateSystemDialog sample

Thanks

Uma

0 Kudos
AbelPerez
Occasional Contributor III

Thank you Uma Harano‌. Yes I have taken a look at the sample. My question is how does that differ from the built in control as I have asked here https://community.esri.com/thread/252237-how-do-i-use-the-coord-system-dialog . The sample works but I was unclear on how to use it in my own add-in. What I did was just reference the DLL just as if it were any other .NET library. At first I thought I had to register the CoordSysDialog add-in like I do mine. If there was a note in the documentation on how to use it in your own project i may have missed it.

0 Kudos
UmaHarano
Esri Regular Contributor

Hi!

I am assuming you want to display Pro's coordinate system control in a dockpane or a dialog in your add-in.

The sample displays this control in a "ProWindow" - which is like a "Dialog".

These are the rough steps to accomplish this:

* Add a dockpane or a ProWindow to your add-in using the SDK Item template.

* In the XAML that gets stubbed out for you, you will add the reference to ArcGIS.Desktop.Mapping.Controls dll.

xmlns:mapping="clr-namespace:ArcGIS.Desktop.Mapping.Controls;assembly=ArcGIS.Desktop.Mapping"

* You will be able to "display" the coordinate system picker "UserControl" that is in this assembly.  You will do that using something like this in the xaml: 

<mapping:CoordinateSystemsControl  x:Name="CoordinateSystemsControl"
                          ConfigureControl="{Binding Path=ControlProperties}"/>

In the sample I mentioned, check out the file - Geometry/CoordinateSystemDialog/UI/CoordSysDialog.xaml

This is the "ProWindow" that displays the control. It has a code behind file, and a View/ViewModel associated with it. All these are in the UI folder of the sample. These items together implement the logic for the control.

Let me know if you need any help.

Thanks

Uma

NarelleChedzey
Esri Contributor

Hi Jeff, 

Updates were made to the Coordinate System Control to more fully support custom spatial references. These updates were made in ArcGIS Pro 2.6 which is now available.  

Please let us know if you see any other issues with this control.

Thanks

Narelle

0 Kudos