Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
How to obtain bound items in zoombar range?
posted

Hi,

I'm trying to use the Timeline control as a "filter" control.  This is, when I select a range in the zoom bar I would like to obtain the items in range.  At least, I would like to know the date ranges.  I'm just intererest in the Zoombar part of the control (I collapsed the Scene part by setting the Height and MinHeight as 70 for the Timeline control).

For example, in the attached image I should obtain 06/01/2017, 07/01/2017 and 10/01/2017 (or at least 06/01/2017 AND 10/01/2017).

How can I do this?

Thanks a lot in advance

  • 34510
    Offline posted

    Hi Rodrigo,

    Since you have dates in your zoombar I'll assume that you are using a DateTimeAxis in the XamTimeline.  DateTimeAxis has properties called VisibleMinimum and VisibleMaximum which are updated when the zoombar thumb is resized or moved around to reflect what the date range is on screen in the timeline.  You can use these properties to get your date range.  I.e. you can handle the XamTimeline.Zoombar.ZoomChanged event and inside the event access the XamTimeline.Axis, cast it to a DateTimeAxis and then inspect the VisibleMinimum and VisibleMaximum properties.

    private void Zoombar_ZoomChanged(object sender, ZoomChangedEventArgs e)
    {
        var axis = timeline.Axis as DateTimeAxis;
        var minDate = axis.VisibleMinimum;
        var maxDate = axis.VisibleMaximum;
    }