Hi,
Is it possible to hoverover an element and hightlight all other elements with a similar property? Say I have 10 elements in a state and 3 are managed by the same person, can I hover over 1 of those three and have all three highlight?
Hi conrad1209,
An approach you could use is the following:
XAML: <igMap:XamMap x:Name="xamMap"> <igMap:XamMap.Layers> <igMap:MapLayer x:Name="statesLayer" Imported="statesLayer_Imported"> <igMap:MapLayer.Reader> <igMap:ShapeFileReader Uri="Shapefiles/usa_st" DataMapping="Name,Caption=STATE_NAME"/> </igMap:MapLayer.Reader> </igMap:MapLayer>
<igMap:MapLayer x:Name="symbolLayer"/> </igMap:XamMap.Layers> </igMap:XamMap>
CB:private List<MapElement> _highlightedElements = new List<MapElement>(3);
public MainPage() { InitializeComponent();
xamMap.ElementHoverAction = ElementHoverAction.None; xamMap.ElementHover += xamMap_ElementHover; xamMap.ElementUnhover += xamMap_ElementUnhover; }
private void statesLayer_Imported(object sender, Infragistics.Controls.Maps.MapLayerImportEventArgs e) { if (e.Action == MapLayerImportAction.End) { Rect worldRect = xamMap.Layers[0].WorldRect;
foreach (MapElement elementsymb in this.xamMap.Layers[0].Elements) { SymbolElement myS = new SymbolElement();
Point symOrigin = new Point(elementsymb.WorldRect.X + .5 * elementsymb.WorldRect.Width, elementsymb.WorldRect.Y + 0.5 * elementsymb.WorldRect.Height);
myS.SymbolOrigin = symOrigin; myS.SymbolType = MapSymbolType.Hourglass; myS.SymbolSize = 15; myS.Fill = new SolidColorBrush(System.Windows.Media.Colors.Orange); myS.Value = elementsymb.Value; myS.Name = "Symbol" + elementsymb.Name.ToString();
xamMap.Layers[1].Elements.Add(myS);
worldRect = xamMap.Layers[1].WorldRect; worldRect.Union(myS.WorldRect);
xamMap.Layers[1].WorldRect = worldRect;
myS = null; } } }
void xamMap_ElementUnhover(object sender, MapElementHoverEventArgs e) { foreach (var element in _highlightedElements) { element.Fill = new SolidColorBrush(System.Windows.Media.Colors.Orange); }
_highlightedElements.Clear(); }
private void xamMap_ElementHover(object sender, MapElementHoverEventArgs e) { if (e.Element.Name == "SymbolKansas") { _highlightedElements.Add(e.Element); _highlightedElements.Add(xamMap.Layers[1].Elements["SymbolColorado"].Single()); _highlightedElements.Add(xamMap.Layers[1].Elements["SymbolNebraska"].Single());
foreach (var element in _highlightedElements) { element.Fill = new SolidColorBrush(Colors.Red); } } }
Best Regards,Milana Zhileva
Thank you, I might have miss phrased my question. I need to do that for Symbols not elements.
Please take a look at the following forum post:http://forums.infragistics.com/forums/p/51549/269442.aspx#269442
Hope that helps,Milana Zhileva