Select to view content in your preferred language

Timeslider widget for Silverlight Viewer

4598
2
10-21-2012 10:04 PM
tanyabisen
New Contributor
Hi,

I am trying to configure TimeSlider tool as a widget in Silverlight Viewer but I am unable to do it.

I am not able to set intervals for my Time Aware layer. I am posting my .xaml code and .cs code. Kindly help me as to where I am going wrong.

Rest end point: http://182.72.232.27/ArcGIS/rest/services/TimeSlider/MapServer/0

XAML:

<esri:TimeSlider x:Name="MyTimeSlider" HorizontalAlignment="Left" Margin="15" VerticalAlignment="Top" Width="212"
      Height="20" TimeMode="TimeExtent"
                        MinimumValue="{Binding Layer.TimeExtent.Start, Mode=OneWay}"
         MaximumValue="{Binding Layer.TimeExtent.End, Mode=OneWay}"
                        Value="2012/10/07 17:00:00 UTC, 2012/10/14 17:00:00 UTC">
        </esri:TimeSlider>

C#:

TimeExtent timeExtent = null;

            foreach (Layer layer in this.MapControl.Layers)
            {
                if (layer is FeatureLayer)
                {
                    timeExtent = ((FeatureLayer)layer).TimeExtent;
                }
                else if (layer is ArcGISDynamicMapServiceLayer)
                {
                    timeExtent = ((ArcGISDynamicMapServiceLayer)layer).TimeExtent;
                }
            }

            List<DateTime> intervals = new List<DateTime>();

            TimeSpan timeSpan = timeExtent.End.Subtract(timeExtent.Start);

            // Divide the time span by 20 to set the slider intervals
            //double timeInterval = timeSpan.TotalDays;
            double timeInterval = timeSpan.TotalDays / 20;
            DateTime dt = timeExtent.Start;
            for (int i = 0; i < 20; i++)
            {
                intervals.Add(dt);
                dt = dt.AddDays(timeInterval);
            }
            MyTimeSlider.Intervals = intervals;

            this.MapControl.TimeExtent = new TimeExtent(timeExtent.Start, timeExtent.Start.AddDays(timeInterval * 4));
        }

Any help would be greatly appreciated.

Thanks,
Tanya Bisen
0 Kudos
2 Replies
tanyabisen
New Contributor
Nobody has tried it  ?? I need help guys...please help me..

Thanks,
Tanya
0 Kudos
Rizky_DavitNugroho
New Contributor

Dear Tanya,

Do you find solution for this probelm? Or do you have this widget? Could I ask you to share this widget? please, I'm in need.

Thanks.

0 Kudos