This is a migrated thread and some comments may be shown as answers.

Real-Time TimeBar and Auto-Expand

3 Answers 112 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 09 Jan 2015, 05:25 PM
Hello, two questions in one thread:

1. Is there any way to get real-time changes in VisiblePeriodStart and VisiblePeriodEnd?

2. I have a TimeBar whose PeriodEnd changes several times a second, and double-clicking to maximize the TimeBar's visible period doesn't cause the TimeBar to keep up with new PeriodEnd changes. Is there any way to set the TimeBar to auto-expand its visible period in code-behind?

Thank you!

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 14 Jan 2015, 03:57 PM
Hi Tyler,

Let me get straight to your questions:
  1. Is there any way to get real-time changes in VisiblePeriodStart and VisiblePeriodEnd?
    Yes, there are couple approaches to get the runtime changes in the visible period range. The first one is to subscribe for the VisiblePeriodChanged event of RadTimeBar and get the . The other one is to bind the VisiblePeriodEnd/Start properties to properties from your view model that listens for changes through the INotifyPropertyChanged interface. This way each time the visible period is change the setters of the properties in your view model will be called.
  2.  I have a TimeBar whose PeriodEnd changes several times a second, and double-clicking to maximize the TimeBar's visible period doesn't cause the TimeBar to keep up with new PeriodEnd changes. Is there any way to set the TimeBar to auto-expand its visible period in code-behind?
    You can expand the timebar's visible period in code-behind by setting its VisiblePeriodStart and VisiblePeriodEnd properties. For example:
    var newPeriodEnd = this.model.PeriodEnd.AddHours(1);
    this.model.PeriodEnd = newPeriodEnd;
     
    if (visible is range maximized)
    {
        this.model.VisiblePeriodEnd = newPeriodEnd;
    }
    However, when you set the PeriodEnd to a new value and then set the VisiblePeriodEnd to the same value, since the scroll UI element (which is RadSlider) works with Ticks there might be a double rounding and this is why the flicker appears. To resolve this you can set the UseLayoutRounding property of the RadTimeBar control to True.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Tyler
Top achievements
Rank 1
answered on 14 Jan 2015, 08:57 PM
Hey Martin, thanks for the response.

1. I'm currently subscribed to VisiblePeriodChanged and I only get event updates when the user has released the mouse after panning/zooming (not real-time). My model also implements INotifyPropertyChanged and it shows the same update pattern. For context I'm using the 2013 Q2 release.

2. I've implemented your fix and it works fine, I was just hoping there was a more elegant built-in "AutoExpandMode = Expand" solution. Thank you though, this answers the question.
0
Martin Ivanov
Telerik team
answered on 16 Jan 2015, 03:10 PM
Hello Tyler,

The VisiblePeriodRange is updated when the dragging of the slider is completed and the mouse is up. However, RadTimeBar exposes a ActualVisibleRange property that holds the actual range of the slider and it is updated while dragging (panning, zooming) the slider. You can use it to achieve your requirement.

If you want to execute a logic when the property is changed you can create a property in your view model that holds the actual range and bind it in one way to source mode with the ActualVisiblePeriodRange of the time bar. Then call your logic in the custom property's setter.

If this does not help, can you describe what you want to achieve? This way we will better understand your scenario and we will be able to assist you further.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TimeBar
Asked by
Tyler
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Tyler
Top achievements
Rank 1
Share this question
or