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

2 posts, 0 answers
  1. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 15 Dec 2011 Link to this post

    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.

  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 20 Dec 2011 Link to this post

    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 >>

  3. DevCraft banner
Back to Top