I never found a solution through ESRI's tools. I still don't know if its a bug or a missing feature.I ended up solving this problem by implementing the messenger system from MVVMLight along with some attached behavior using System.Windows.Interactivity.Here is the message.
/// <summary>
/// Class representing messages to be sent when DataPoints get selected.
///
/// </summary>
public class DataPointSelectedMessage : GenericMessage<List<DataPoint>>
{
public DataPointSelectedSource Identifier { get; set; }
public DataPointSelectedMessage(List<DataPoint> data)
: base(data)
{
}
}
Defining the behavior:
/// <summary>
/// Behavior attaching to a button.
/// </summary>
public class DataPointGraphicSelectedBehavior : Behavior<GraphicsLayer>
{
/// <summary>
/// Event that occurs when something is attached to this.
/// AssociatedObject is the object that we're attaching this to.
/// </summary>
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.MouseLeftButtonUp += new GraphicsLayer.MouseButtonEventHandler(AssociatedObject_Click);
}
/// <summary>
/// What do we want to do when the associated object is clicked?
/// </summary>
/// <param name="sender">Sender (associated object?)</param>
/// <param name="e"></param>
void AssociatedObject_Click(object sender, GraphicMouseButtonEventArgs e)
{
//DataPoint Point = e.Graphic.Attributes["DataContext"] as DataPoint;
//Point.SelectMe(DataPointSelectedSource.Map);
List<DataPoint> listofpointselected = new List<DataPoint>();
listofpointselected.Add((DataPoint)e.Graphic.Attributes["DataContext"]);
Messenger.Default.Send(new DataPointSelectedMessage(listofpointselected) { Identifier = DataPointSelectedSource.Map });
}
protected override void OnDetaching()
{
AssociatedObject.MouseLeftButtonDown -= AssociatedObject_Click;
base.OnDetaching();
}
}
Attaching the behavior:
<esri:GraphicsLayer ID="graphics">
<i:Interaction.Behaviors>
<mvBehaviours:DataPointGraphicSelectedBehavior />
</i:Interaction.Behaviors>
...
</esri:GraphicsLayer>
I just announce that a point as been selected, and the datapoints all listen and check if they're the one thats been called. Then they change their status to correspond to it, which propogates across the app. Alternatively, other objects can listen for changes, and act accordingly (specifically, I can keep track of which are selected in collections).This is probably more complex than and less performant than minerjoe's suggestion, but I've found that the messenger system makes things a bit more flexible for my purposes, and allows me to have more information about where the selection is coming from, and I don't have to worry about tying codebehind to my viewmodel--instead, the attached behavior (which i consider to be basically code-behind, though it technically isn't) just sends a generic notification to a central messenger that an event has occurred, and I can very cleanly and easily register listeners for when the event happens.