I am tryng to access wpfMap Witdh and Heights using HelloWorld_WPFDesktop example, but both of them are NaN.
Any idea why it is happenning ? (I am running latest trial version)
private void wpfMap1_CurrentScaleChanged(object sender, CurrentScaleChangedWpfMapEventArgs e) { ZoomLevel zl = wpfMap1.ZoomLevelSet.GetZoomLevel(wpfMap1.CurrentExtent, wpfMap1.Width, wpfMap1.MapUnit); }
Gary2
September 18, 2012, 3:06pm
2
Hello Michael, Thanks for your post, do you modify anything of that sample? Is that possible you can upload it here? Regards, Gary
Hi Gary,
I only upgraded it to VS2010 and added wpfMap1_CurrentScaleChanged handler.
Plese, look onto attached zip.
Thank you,
Michael
HelloWorld_WPFDesktopZoom.zip (32.1 KB)
Gary2
September 19, 2012, 7:01pm
4
Hello Michael,
The reason is you are using wpfMap1_CurrentScaleChanged, and in this time, the map does not totally initialized, so you can't get Width and Height. You can try: void wpfMap1_CurrentExtentChanged(object sender, CurrentExtentChangedWpfMapEventArgs e) { ZoomLevel zl = wpfMap1.ZoomLevelSet.GetZoomLevel(wpfMap1.CurrentExtent, wpfMap1.Width, wpfMap1.MapUnit); } Let us know your queries. Regards, Gary
Hi Gary,
Unfortunately that change did not helped - same error.
Howewer, all working when I am using wpfMap1.ActualWidth
Any idea why ?
Thank you,
Michael
Gary2
September 20, 2012, 5:02pm
6
Hello Machael, Sorry I made a mistake to paste the code, please use e.MapWidth instead of wpfMap1.Width, the reason is like I said above, the map control does not totally initiative. Regards, Gary