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

ScheduleView and TimeBar example set visible period bug

2 Answers 110 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 25 Jun 2012, 12:23 PM
In my application I am using code of TimeBar demo http://demos.telerik.com/silverlight/#ScheduleView/TimeBar, but can't get over a bug in Telerik.Windows.Examples.ScheduleView.TimeBar.Example class. Only visible period start is being set when TimeBar slider is moved:
  1. user moves TimeBar slider,
  2. TimeBar_VisiblePeriodChanged() fires 1st time,
  3. TimeBar rounded visible period start is set at line
    this.TimeBar.VisiblePeriodStart = roundedVisiblePeriodStart;

    and this is reflected in browser,
  4. TimeBar_VisiblePeriodChanged() fires 2nd time,
  5. compiler executes rounded visible period end assignment line
    this.TimeBar.VisiblePeriodEnd = roundedVisiblePeriodEnd;

    but visually nothing happens in browser and TimeBar_VisiblePeriodChanged() while expected doesn't fire for the 3rd time.

This results firstly in loss of visual synchronization between TimeBar and MinimapSchedule, and secondly in slidebar growing after each dragging operation.

The effect is especially pronounced when you adjust visible period to show days instead of weeks:
<telerik:RadTimeBar x:Name="TimeBar" Margin="2" Grid.ColumnSpan="2"
        telerik:StyleManager.Theme="Metro" Background="Transparent" PeriodStart="6/1/2011 12:00:00 AM"
        PeriodEnd="7/1/2011 11:59:59 PM" VisiblePeriodStart="6/7/2011 12:00:00 AM"
        VisiblePeriodEnd="6/22/2011 11:59:59 PM" SelectionStart="6/14/2011 12:00:00 AM"
        SelectionEnd="6/14/2011 11:59:59 PM" MinSelectionRange="1.00:00:00" MaxSelectionRange="7.00:00:00"
        MinZoomRange="1.00:00:00" IsSnapToIntervalEnabled="True"
        VisiblePeriodChanged="TimeBar_VisiblePeriodChanged">

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 28 Jun 2012, 11:35 AM
Hi Sergey,

You can use the following approach to correct the problem that you describe:
private bool updateInProgress = false;
 
private void TimeBar_VisiblePeriodChanged(object sender, RadRoutedEventArgs e)
{
    if (this.updateInProgress)
        return;
 
    if (this.TimeBar != null)
    {
        DateTime roundedVisiblePeriodStart = this.TimeBar.VisiblePeriodStart.Date;
        DateTime roundedVisiblePeriodEnd = this.TimeBar.VisiblePeriodEnd.Date;
 
        this.updateInProgress = true;
 
        if (roundedVisiblePeriodStart != this.TimeBar.VisiblePeriodStart)
        {
            this.TimeBar.VisiblePeriodStart = roundedVisiblePeriodStart;
        }
        if (roundedVisiblePeriodEnd != this.TimeBar.VisiblePeriodEnd)
        {
            this.TimeBar.VisiblePeriodEnd = roundedVisiblePeriodEnd;
        }
 
        this.updateInProgress = false;
 
        this.UpdateMinimap();
    }
}

Kind regards,
Tsvetie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sergey
Top achievements
Rank 1
answered on 29 Jun 2012, 06:47 AM
Thanks!
Tags
TimeBar
Asked by
Sergey
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Sergey
Top achievements
Rank 1
Share this question
or