Hello!
Now im adding images represent of sensors(JPEG or PNG) over the map element for more interactivity. when i put my mouse on the image ,a panel contains data from database will display,the panel won't disapper unitl my mouse move out of the panel. How can I do this?
In the XmlFile,I add three Layers as following:
<igMap:XamWebMap x:Name="map1" ElementHover="XamWebMap1_Elementhover" ElementUnhover="XamWebMap_ElementUnHover">
<igMap:XamWebMap.Layers> <igMap:MapLayer x:Name="statesLayer" Imported="provinceLayer_Imported"> <igMap:MapLayer.Reader> <igMap:ShapeFileReader Uri="Shapefiles/bou2_4p" DataMapping="Caption=ADCODE93" ></igMap:ShapeFileReader> </igMap:MapLayer.Reader> </igMap:MapLayer> <igMap:MapLayer x:Name="symbolLayer"> <igMap:MapLayer.ValueTemplate> <DataTemplate> <Image Width="50" Height="50" Source="Shapefiles/pizza.jpg" IsHitTestVisible="False"/> </DataTemplate> </igMap:MapLayer.ValueTemplate> </igMap:MapLayer>
<igMap:MapLayer x:Name="hoverLayer"> <igMap:MapLayer.ValueTemplate> <DataTemplate> <telerik:RadGridView HorizontalAlignment="Left" Margin="195,163,0,0" Name="radGridView1" VerticalAlignment="Top" ItemsSource="{Binding Source={StaticResource DataSource},Path=MyDatas}" IsHitTestVisible="False" IsSynchronizedWithCurrentItem="true"/> </DataTemplate> </igMap:MapLayer.ValueTemplate> </igMap:MapLayer>
</igMap:XamWebMap.Layers> </igMap:XamWebMap>
in the xml.cs file, the code as following:
private void provinceLayer_Imported(object sender, Infragistics.Silverlight.Map.MapLayerImportEventArgs e) { if (e.Action == MapLayerImportAction.End) { // Find Element using Name property MapElement xinjiang = map1.Layers[0].Elements.FindElement("Caption", "630000").ElementAt<MapElement>(0);
// Get Point data from Cartesian coordinates Point nyOrigin = new Point(xinjiang.WorldRect.X + 350000, xinjiang.WorldRect.Y + 300000);
// Create Element SymbolElement element = new SymbolElement() { SymbolOrigin = nyOrigin, Caption = "青海省", SymbolType = MapSymbolType.None, SymbolSize = 30 };
// Assign arbitrary value so that Value Template can be used element.Value = 1;
map1.Layers[1].Elements.Add(element);
// Make enough space in layer for the added shape Rect worldRect = map1.Layers[1].WorldRect; worldRect.Union(element.WorldRect); map1.Layers[1].WorldRect = worldRect; } } private void XamWebMap1_Elementhover(object sender, Infragistics.Silverlight.Map.mape e) {
// XamWebMap theMap = (XamWebMap)sender; Point pos = e.Element.ActualSymbolOrigin; // pos = map1.Viewport.RootCanvas.RenderTransform.Transform(pos); SymbolElement element = new SymbolElement() { SymbolOrigin = pos, Caption = "青海省", SymbolType = MapSymbolType.None, SymbolSize = 30 }; element.Value = 2; map1.Layers[2].Elements.Add(element); Rect worldRect = map1.Layers[1].WorldRect; worldRect.Union(element.WorldRect); map1.Layers[2].WorldRect = worldRect;
Popup pop = new Popup(); StackPanel sp1 = new StackPanel(); pop.Child = sp1; pop.HorizontalOffset = pos.X; pop.VerticalOffset = pos.Y; pop.IsOpen = true; } private void XamWebMap_ElementUnHover(object sender, MapElementHoverEventArgs e) { map1.Layers[2].Elements.RemoveAt(0); } }
Yes.I have solve the issue.thank you
Hi,
I am just checking if Graham's suggestion helped you solve your issue and if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
do you mean something like this?
http://community.infragistics.com/forums/p/42136/233910.aspx#233910
-Graham