3 Answers, 1 is accepted
0
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
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
0
Will
Top achievements
Rank 1
answered on 23 Aug 2011, 01:27 AM
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?
0
Joel
Top achievements
Rank 1
answered on 23 Aug 2011, 10:55 AM
@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" />
</Canvas>
</Grid>
</telerik:RadTimeBar>
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.
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" />
</Canvas>
</Grid>
</telerik:RadTimeBar>
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.