I have used MapProjection property of a Layer in MapControl to use in my ViewModel to calculate some distances. Since MapProjection is deprecated I should use MapControl.CoordinateSystem to do the same. However the property is never set. Even if I want to use it directly (not by binding) it is not set. I have to cast MapControl to IMapView to get the CoordinateSystem property. So MapControl.CoordinateSystem is null but (MapControl as IMapView).CoordinateSystem is set.
The MapControl.CoordinateSystem property value is not accessible using the binding expression
Answers approved by DevExpress Support
We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.
Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.
- v15.2.4Download Official Update
- v15.1.8Download Official Update
Hi Gregor,
I have modified the source code and included the MapControl.CoordinateSystem property initialization there. In my tests, changes are correctly reflected in your model class:
C#public MainWindow() {
InitializeComponent();
model = new MainViewModel();
DataContext = model;
}
MainViewModel model;
private void Window_Loaded(object sender, RoutedEventArgs e) {
this.mapControl1.CoordinateSystem = new GeoMapCoordinateSystem();
MessageBox.Show(model.MapCoordinateSystem.ToString());
}
Please let me know if you find this approach appropriate or you have any questions. I will be happy to help you.
Hi Gregor,
Thank you for the update. My attempts to reproduce a similar issue were not successful. Attached is an updated sample project that prints the model's MapCoordinateSystem value after the application window is loaded. Please test it on your machine and let me know how it works for you.
Sorry, I still had some references to version 15.1.7. It works now. Thank you for your help.
Thank you for your confirmation, Gregor. It is good news that the problem has been resolved.
Hi Gregor,
Thank you for your report. My attempts to reproduce a similar issue in a newly created application were not successful. Please refer to the attachment and feel free to modify the source code to illustrate the issue. We will be happy to help you.
The problem is when you have a binding to CoordinateSystem property. I changed the project to show it.