Is it possible to host non-sparkline content in the TimeBar thumb?

4 posts, 0 answers
  1. Scott
    Scott avatar
    3 posts
    Member since:
    Apr 2011

    Posted 23 Jun 2011 Link to this post

    I would like to put some simple text inside the TimeBar thumb related to the time period being "viewed".  Is this possible or are sparklines the only supported controls?
  2. Vladimir Milev
    Vladimir Milev avatar
    1061 posts

    Posted 24 Jun 2011 Link to this post

    Hello Scott,

    As the RadTimebar inherits from ContentControl it can host any content you can imagine. We provide examples with the sparkline because it demonstrates a really great synergy between both products but this in no way limits the possible content RadTimeBar can host.

    Best wishes,
    Vladimir Milev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
  4. Will
    Will avatar
    1 posts
    Member since:
    Jul 2011

    Posted 22 Aug 2011 Link to this post

    Adding on to this, if I made my own control for a custom view for the content in the RadTimeBar, how do I use the X values passed from the RadTimeBar?
  5. Joel
    Joel avatar
    5 posts
    Member since:
    Oct 2010

    Posted 23 Aug 2011 Link to this post

    @Will on Passing X values:
    Bind to the PeriodStart and PeriodEnd of the parent time bad. That will be the range of the X values. Dates inbetween are positioned in a linear relationship with the begin and end date. 

    @Scott on Positioning Text:

    I made a custom control that among other things needs to do something like that. While I can't share the code of the custom control I can share something that may put you in the right area of what you need to do. Let's say that text is the only thing that I needed to display in the timebar. The following XAML would suite that purpose. 

    <telerik:RadTimeBar >
      <Grid x:Name="MyContainerEnvelope">
       <Canvas Width="{Binding ElementName=MyContainerEnvelope, Path=ActualWidth}"
                     Height="{Binding ElementName=MyContainerEnveloper, Path=ActualHeight}"
          <TextBlock Text="MyText" />

    The Grid will grow to occupy all of the content space provided to it. The Canvas control doesn't do that, but it's bound to the Grid's Dimensions so it will have the same behaviour. Right now the text will show up aligned to the left and it needs to be repositioned to be aligned with a specific date. 

    void PositionMyText(DateTime targetTime)
       double targetPositionPercentage  =  (double)(d - PeriodBegin).Ticks/(double)(PeriodEnd- PeriodBegin).Ticks;
        MyText.SetValue(Canvas.Left, targetPosition*MyContainerEnveloper.ActualWidth);

    PositionMyText will need to be called anytime the layout of the timebar changes. You can subscribe to the LayoutUpdated event to be notified when you need to call it. 
Back to Top