I'm looking for a way to "highllight" a map element the user clicks on but changing the stroke thickness and color doesn't really work because hovering and unhovering over an element seems to clear out the stroke thickness and color change.
Is there a way to shut off the default element hovering highlighting animation while still keeping a element sensitive to clicks?
What does IsSelectable do?
Thanks
Fredy Daruwalla
if you look at this thread, you can see a workaround which should allow you to simulate map selection through highlighting.
for now, selection isn't a feature of the map, and on MapElements or Layers there is no behavior affected by the IsSelectable property.
Was there supposed to be a link in the reply?
I have a situation where I give each MapElement a SolidColorFill that is green. When the user clicks on the MapElement, I want to color it red. It works, but when the user's mousepointer leaves the MapElement, the color reverts back to the original green. It seems like the ElementUnhover is somehow undoing the change to the MapElement.Fill.
private void floorMap_ElementClick(object sender, Infragistics.Silverlight.Map.MapElementClickEventArgs e)
{
SolidColorBrush fillBrush = new SolidColorBrush();
fillBrush.Color = Color.FromArgb(255, 255, 0, 0);
e.Element.Fill = fillBrush;
}
whoops. yes, here's the link: http://community.infragistics.com/forums/p/20418/73714.aspx#73714
the discussion includes a workaround for the Unhover issue.
I'm not having any luck with the suggested solution. I'm still seeing the fill revert to the previous color (green). I can successfully change the border, so that's what I'm going to use for now.
e.Element.Fill =
;
.Red);
.SelectedElement = e.Element;
e.Element.Stroke =
.Black);
I don't know if it's helpful, but I've found that with the suggested solution that when the map re-centers or changes zoom, the behavior of the elements is still buggy. For example, if I click back-and-forth between two elements that are nearly side-by-size and the map does not change, the elements' fill is correct. But if I click on an element that is on the edge of the viewable window of the map, the map will jump to the clicked element; the fill color of the elements looks right, but if I mouseover the previous element, it will revert the fill to the prior color.
eschmuck said:But if I click on an element that is on the edge of the viewable window of the map, the map will jump to the clicked element;
do you have code hooked up which pans the map when a click occurs? or is this the default behavior you're describing, with no application code involved other than changing brushes?
In the page that I am describing, the XamWebMap is in the center column of a 3-column grid. The widths of the grid are not fixed; they automatically adjust to display data that corresponds to the selected MapElement. If the data is especially wide, the map's width is forced to shrink .
I addressed the problem by giving the columns an explicit width so that the map's width does not change. I don't know if it's a "bug" or not, but it's something worth noting.