// TODO: If we're setting an icon's state to PointerOver, maybe make sure it's the only icon in a PointerOver state? // Hope that's not too slow. // Maybe keep a list of all icons currently in a PointerOver state... public void SetIconState(Guid iconId, MapIconState iconState) { MapIcon matchingIcon = DigiTransitMapControl.MapElements .OfType <MapIcon>() .FirstOrDefault(x => (Guid)x.GetValue(PoiIdProperty) == iconId); if (matchingIcon == null) { return; } // The MapIconChanged callback in the Attached Property handles Image changing on State changes. See MapElementExtensions.cs. matchingIcon.SetValue(MapIconStateProperty, iconState); // Only allow one icon to be highlighted at at time by external callers. if (iconState != MapIconState.None) { foreach (MapIcon activeIcon in DigiTransitMapControl.MapElements. OfType <MapIcon>() .Where(x => (MapIconState)x.GetValue(MapIconStateProperty) != MapIconState.None && (Guid)x.GetValue(PoiIdProperty) != iconId)) { activeIcon.SetValue(MapIconStateProperty, MapIconState.None); } } }
static string ToCustomStyleEntryState(MapIconState state) { if (state.HasFlag(MapIconState.Disabled)) { return("disabled"); } else if (state.HasFlag(MapIconState.Selected)) { return("myNamespace.selected"); } else if (state.HasFlag(MapIconState.Hover)) { return("myNamespace.hover"); } else { return(string.Empty); } }
static string ToDefaultStyleEntryState(MapIconState state) { if (state.HasFlag(MapIconState.Disabled)) { return(MapStyleSheetEntryStates.Disabled); } else if (state.HasFlag(MapIconState.Selected)) { return(MapStyleSheetEntryStates.Selected); } else if (state.HasFlag(MapIconState.Hover)) { return(MapStyleSheetEntryStates.Hover); } else { return(string.Empty); } }
public SetIconState(Guid iconId, MapIconState newState) { MapIconId = iconId; NewState = newState; }
public static void SetMapIconState(DependencyObject element, MapIconState state) { element.SetValue(MapIconStateProperty, state); }