hi
Its possible to add user controls on the map ie... whether we can add text box button over xamwebmap.if any one know means pls guide me
Do you mean hovering over the map at specific coordinates? Or do you mean hovering over a specific element? Or do you mean positioned in a map layer?
-Graham
Hi,
Hovering over the specific element. Is it possible. If so please give some link for online tutorials
Here's another sample that uses the XamWebGrid in the value template. Let me know if this helps.
Hi Graham
I am using value template to load data grid over map as you suggested. Its working fine when i use single layer but when i use more than one layer its not working. it loads the data grid when i click each element. ie when i click element 1 it loads the data grid and when i click the element 2 it loads the data grid again and the data grid loaded first is also visible. And one more problem is when i use shape file it loads the data grid over the element which was clicked but when use Geo spatial data instead of shape files it always loads the grid at center of the map. can you please check.
I can't see your code but I'm guessing your bug is in this section:
foreach (MapElement ele in (sender as XamWebMap).Layers[0].Elements) { if (MapData.GetValueData(ele) != null && MapData.GetValueData(ele).GetType() == typeof(MapGridData)) { MapData.SetValueData(ele, null); } }
You will have to clear the values that are set on elements in all layers if you wan't the other data grids to vanish. If an element has a value, the grid will show, if it doesn't the grid won't show.
thanks its working fine now. but i have a problem when i use geo spatial data instead of shape files. the controls that are added using data template is always loading in center of the map instead on particular element. when i click next element its just updating the control but displaying at the same position i.e at the center of the map. what may be the problem. here with i attached the code. find the attachment above pls...
This should behave the same as the shapefiles from my understanding. Is there any sample code you can provide that reproduces this issue?
Ya the elements are visible again if i zoom in or zoom out...
Are they visible again if you zoom in further?
Great work really working nice.... but the problem is now when i pan the map some elements are not visible if i do zoom in or zoom out only its coming to visible if i do the code suggested by you.
you can see the difference in the following two snapshots
before pan
after pan(in selected area some elements are missing)
Shapes read from the SQL shape reader are not currently designed to work with the value templates. This is easy enough to work around with this MapLayer.Imported handler:
void MainPage_Imported(object sender, MapLayerImportEventArgs e) { foreach (MapElement ele in xamMap.Layers["USALayer"].Elements) { if (ele is SurfaceElement) { double minX = double.MaxValue; double minY = double.MaxValue; double maxX = double.MinValue; double maxY = double.MinValue; foreach (MapPolyline mpl in (ele as SurfaceElement).Polylines) { foreach (Point p in mpl) { minX = Math.Min(minX, p.X); minY = Math.Min(minY, p.Y); maxX = Math.Max(maxX, p.X); maxY = Math.Max(maxY, p.Y); } } ele.WorldRect = new Rect(minX, minY, maxX - minX, maxY - minY); } } xamMap.Layers["USALayer"].RenderWindow(); }
This help? (Obviously, replace USALayer with whatever your layer name is.)
Actually, I've run some experiments and I'm seeing similar behavior. I will try to determine whether this is a bug with the SQL shape reader, or whether we just don't currently support valuetemplates from this source.