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

Use RadTimeBar for selecting 1 or more (only a few though) weeks?

1 Answer 68 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 15 Dec 2011, 10:49 PM
Hello,

I'm new to the RadTimeBar.  It looks like the documentation isn't quite complete yet so I'll ask this here.

My basic requirement is to allow the user to select a date range consisting of a single or a few (maybe up to a maximum of 8) weeks.  But have them restricted to choosing full weeks only that are snapped to start on Sundays and end on Saturdays, just like a real week :)  I would like the zooming to show "Months" at the Group Level, and "Weeks" at the Item Level so that clicking on an item, would select that single week and resizing the item would snap to multiples of weeks only.  Is there a way to restrict the control to show only these two interval types?  From what I have tested, I can't seem to find the right combination of properties to make this work.

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 20 Dec 2011, 01:40 PM
Hi Rob,
Straight to your questions:
  1. RadTimeBar shows only intervals from its Intervals collections. That is why, you should add only the Week and Month intervals to that collection in order to have only Week and Month intervals:
    <telerik:RadTimeBar.Intervals>
        <telerik:WeekInterval />
        <telerik:MonthInterval />
    </telerik:RadTimeBar.Intervals>
  2.  You can specify a minimum time range for the selection, using the MinSelectionRange property:
    <telerik:RadTimeBar x:Name="RadTimeBar2" Height="250" IsSnapToIntervalEnabled="True"
            PeriodStart="2000-01-01" PeriodEnd="2000-03-03"
            MinSelectionRange="7.00:00:00">
  3. In case you have an upper time range limit as well, you can enforce it using the MaxSelectionRange property.
  4. As your items are weeks and your groups are months, in case you enable the snapping feature, the selection will snap to weeks and months only:
    <telerik:RadTimeBar x:Name="RadTimeBar2" Height="250" IsSnapToIntervalEnabled="True"
            PeriodStart="2000-01-01" PeriodEnd="2000-03-03"
            MinSelectionRange="7.00:00:00">

Here is a simple code snippet, demonstrating the above mentioned features:
<telerik:RadTimeBar x:Name="RadTimeBar2" Height="250" IsSnapToIntervalEnabled="True"
        PeriodStart="2000-01-01" PeriodEnd="2000-03-03"
        MinSelectionRange="7.00:00:00">
    <telerik:RadTimeBar.Intervals>
        <telerik:WeekInterval />
        <telerik:MonthInterval />
    </telerik:RadTimeBar.Intervals>
</telerik:RadTimeBar>
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
Rob
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or