Please excuse my noobness when it comes to Silverlight, I'm still learning it.I am currently trying to select an item in my FeatureLayer based on a row click of a DataGrid.I found this thread, which I thought would get me on the right track, and I think I'm half way there.http://forums.arcgis.com/threads/19265-Selection-Based-on-Attributes?highlight=featurelayer+selectio...
<esri:FeatureLayer ID="WorkOrders" x:Name="wo_FeatureLayer" Url="http://servername/ArcGIS/rest/services/WorkOrders/MapServer/0"
OutFields="*">
</esri:FeatureLayer>
Then I have a DataGrid with some data where a single field matches an ID in my FeatureLayer. I use the DataGrids SelectionChanged event to start my query.
private void wo_DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
WORK_ORDER wo = e.AddedItems[0] as WORK_ORDER;
MessageBox.Show(wo.WorkOrderID.ToString());
// when I step through on a breakpoint here, it always tells me wo_FeatureLayer is null
var graphic = wo_FeatureLayer.Where(g => g.Attributes["MXWONUM"].ToString() == wo.WorkOrderID.ToString()).First();
graphic.Select();
}
catch(Exception err)
{
MessageBox.Show("oops:" + err.Message);
}
}
The resulting error is, "Value cannot be null. Parameter name:source"I know the FeatureLayer works, because I use it's MouseLeftDown event to populate another window without issue.I'm sure I must be missing something simple, but a nudge in the right direction would be helpful.Thanks.