Hi Jennifer,Thanks for getting back to me.You are correct, the sample works with the layer I'm trying to query. When I look at the attributes by left clicking on a graphic it has a valid timeextent. However, like I said, when I query that same layer for that same record the graphic returned in the featureset has a timeextent of null.I should have mentioned that the layer in question is an event layer which I assume is what's causing the issue. It displays and interacts with the time slider correctly but I've had trouble accessing it through the query operation.
Xaml:
<esri:FeatureLayer ID="EarthquakesLayer" MouseLeftButtonDown="FeatureLayer_MouseLeftButtonDown"
Initialized="FeatureLayer_Initialized"
Url="http://server/ArcGIS/rest/services/lane_closure_events/MapServer/2"
FeatureSymbol="{StaticResource MyMediumMarkerSymbol}"
OutFields="*">
C#:
private void FeatureLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
{
QueryTask queryTask = new QueryTask("http://server/ArcGIS/rest/services/lane_closure_events/MapServer/2");
queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
Query query = new Query();
query.ReturnGeometry = true;
query.OutFields.Add("*");
query.Where = "OBJECTID = " + e.Graphic.Attributes["OBJECTID"].ToString();
Debug.WriteLine(query.Where + " Time extent - ");
Debug.WriteLine(e.Graphic.TimeExtent.ToString());
queryTask.ExecuteAsync(query);
}
private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
FeatureSet featureSet = args.FeatureSet;
if (featureSet.Features.Count > 0)
{
Debug.WriteLine("OBJECTID = " + args.FeatureSet.Features[0].Attributes["OBJECTID"].ToString() + " Time extent - ");
if (args.FeatureSet.Features[0].TimeExtent == null)
{
Debug.WriteLine("No Date");
}
else
{
Debug.WriteLine(args.FeatureSet.Features[0].TimeExtent.ToString());
}
}
}
Output:
OBJECTID = 2323 Time extent -
2011-08-05 07:00:00Z,2011-08-05 19:00:00Z
OBJECTID = 2323 Time extent -
No Date
(Hope this code is readable 🙂 )Thanks!Jill