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

RadTimeBar and MVVM

4 Answers 111 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Robert Bevis
Top achievements
Rank 1
Robert Bevis asked on 15 May 2012, 06:21 PM
Hi,

I'm using radtimebar on version 2012.1.514.1050 and I'm having an issue with the behaviour of the MinSelectionRange and MaxSelectionRange.
I've this MVVM scenario and seems that the MinSelectionRange and MaxSelectionRange does not work and allows any selection. The same scenario with static properties (like on firtst look sample) works just fine.

My RadtimeBar code is:

    <telerik:RadTimeBar Name="timeBar1" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,10,10,10"
                                    PeriodStart="{Binding Path=PeriodStart,Mode=TwoWay}" PeriodEnd="{Binding Path=PeriodEnd,Mode=TwoWay}"
                                    VisiblePeriodStart="{Binding Path=VisiblePeriodStart,Mode=TwoWay}" VisiblePeriodEnd="{Binding Path=VisiblePeriodEnd,Mode=TwoWay}"  
                                    SelectionStart="{Binding Path=SelectionStart,Mode=TwoWay}" SelectionEnd="{Binding Path=SelectionEnd,Mode=TwoWay}" 
                                    IsSnapToIntervalEnabled="true"
                                    MinSelectionRange="3.00:00:00"
                                    MaxSelectionRange="14.00:00:00">
            <telerik:RadTimeBar.Intervals>
                <telerik:QuarterInterval />
                <telerik:MonthInterval />
                <telerik:WeekInterval />
                <telerik:DayInterval />
                <telerik:HourInterval/>
            </telerik:RadTimeBar.Intervals>
            <Grid>
                <telerik:RadColumnSparkline ItemFill="Salmon" ItemsSource="{Binding Alerts}" XValuePath="TimeStamp" YValuePath="Count" Opacity="0.7"/>
                <telerik:RadLinearSparkline LineStroke="Blue" ItemsSource="{Binding Events}" XValuePath="TimeStamp" YValuePath="Count" LineShapeStyle="{StaticResource SparklineLineStyle}" Opacity="0.9" />
            </Grid>
                                    MinSelectionRange="3.00:00:00"
                                    MaxSelectionRange="14.00:00:00">

4 Answers, 1 is accepted

Sort by
0
Robert Bevis
Top achievements
Rank 1
answered on 16 May 2012, 09:12 AM
Think I'll just open a ticket with this since I've receive no feedback

Thanks
0
Tsvetie
Telerik team
answered on 17 May 2012, 03:47 PM
Hi,

We are aware of this problem and it is already on our ToDo list. You can vote and track the progress on the problem here.

For the time being, the only workaround that I can offer you, is to bind the selection range properties as well and set them, after you have set values for the PeriodStart and PeriodEnd properties. For example:

<telerik:RadTimeBar x:Name="timebar1" Width="700" Height="300"
                    PeriodStart="{Binding StartDate, Mode=TwoWay}"
                    PeriodEnd="{Binding EndDate, Mode=TwoWay}"
                    VisiblePeriodStart="{Binding VisibleStart, Mode=TwoWay}"
                    VisiblePeriodEnd="{Binding VisibleEnd, Mode=TwoWay}"
                    MinSelectionRange="{Binding MinSelection, Mode=TwoWay}"
                    MaxSelectionRange="{Binding MaxSelection, Mode=TwoWay}">

StartDate = DateTime.Today;
EndDate = StartDate.AddDays(1);
 
DateTime now = DateTime.Now;
VisibleStart = now.AddMinutes(-30);
VisibleEnd = now.AddMinutes(30);
 
MinSelection = TimeSpan.FromMinutes(30);
MaxSelection = TimeSpan.FromMinutes(60);
Regards,
Tsvetie
the Telerik team

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

0
Robert Bevis
Top achievements
Rank 1
answered on 17 May 2012, 04:30 PM
Hi,

Thanks for the feedback. Sorry but I'm not understanding your workaround.
You are saying " the only workaround that I can offer you, is to bind the selection range properties as well and set them, after you have set values for the PeriodStart and PeriodEnd properties "

And on your sample,  you have remove the SelectionStart and SelectionEnd that I has on my sample...
Can you clarify a little better the workaround ?

Thanks
0
Tsvetie
Telerik team
answered on 21 May 2012, 12:44 PM
Hello,

I have attached my test code in order to demonstrate the workaround that I suggested. I added binding expressions for the SelectionStart and SelectionEnd properties as well.

Basically, the problem comes from the fact that the MinSelectionRange and MaxSelectionRange properties and coerced against the whole period - [PeriodStart; PeriodEnd), and that is why, you should make sure that you set them after you have set the whole period.

Kind regards,
Tsvetie
the Telerik team

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

Tags
TimeBar
Asked by
Robert Bevis
Top achievements
Rank 1
Answers by
Robert Bevis
Top achievements
Rank 1
Tsvetie
Telerik team
Share this question
or