or
namespace
TimelineTest
{
public
partial
class
MainWindow : Window
{
private
List<Item> items =
new
List<Item>();
public
MainWindow()
{
InitializeComponent();
items.Add(
new
Item() { Date =
new
DateTime(2014, 5, 5), Duration = TimeSpan.FromHours(5) });
items.Add(
new
Item() { Date =
new
DateTime(2014, 5, 5, 14, 18, 22), Duration = TimeSpan.FromHours(5) });
timeline.ItemsSource = items;
}
public
class
Item
{
public
TimeSpan Duration {
get
;
set
; }
public
DateTime Date {
get
;
set
; }
}
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
DateTime now = DateTime.Now;
timebar.PeriodStart =
new
DateTime(now.Year, now.Month, now.Day, 0, 0, 0);
timebar.PeriodEnd =
new
DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
}
}
}
<
Window
x:Class
=
"TimelineTest.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
telerik:RadTimeBar
Name
=
"timebar"
Height
=
"64"
Margin
=
"10,0,10,193"
PeriodStart
=
"5/5/2014 00:00:00"
PeriodEnd
=
"05/5/2014 23:59:59"
VerticalAlignment
=
"Bottom"
MaxSelectionRange
=
"0:0:10"
MinSelectionRange
=
"0:0:10"
SelectionTitleFormatString
=
"{}{0:MM-dd-yy HH:mm:ss}"
>
<
telerik:RadTimeBar.Intervals
>
<
telerik:HourInterval
IntervalSpans
=
"1,4"
/>
<
telerik:MinuteInterval
IntervalSpans
=
"1,5,15,30"
/>
</
telerik:RadTimeBar.Intervals
>
<
telerik:RadTimeBar.Content
>
<
telerik:RadTimeline
Name
=
"timeline"
Margin
=
"0, -65, 0, 0"
PeriodStart
=
"{Binding PeriodStart, ElementName=timebar}"
PeriodEnd
=
"{Binding PeriodEnd, ElementName=timebar}"
telerik:StyleManager.Theme
=
"Windows8Touch"
StartPath
=
"Date"
DurationPath
=
"Duration"
ScrollMode
=
"None"
>
<
telerik:RadTimeline.Intervals
>
<
telerik:DayInterval
IntervalSpans
=
"1"
/>
</
telerik:RadTimeline.Intervals
>
</
telerik:RadTimeline
>
</
telerik:RadTimeBar.Content
>
</
telerik:RadTimeBar
>
<
Button
Content
=
"Button"
HorizontalAlignment
=
"Left"
Margin
=
"125,230,0,0"
VerticalAlignment
=
"Top"
Width
=
"75"
Click
=
"Button_Click"
/>
</
Grid
>
</
Window
>
class Order {
public List<
OrderLine
> Lines { get; }
}
class OrderLine {
public int Index { get; }
public string Data { get; }
}
To achieve this, I created a custom column:
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
{
// more code to create item etc.
item.SetBinding(FrameworkElement.DataContextProperty,
new Binding(DataMemberBindingPath) { Source = dataItem });
}
internal virtual Expression CreateSortKeyExpression(ParameterExpression parameterExpression, ExpressionBuilderOptions options)
{
var builder = CreateBuilder(parameterExpression, this.EffectiveSortMemberType, this.EffectiveSortMemberPath, options);
return builder.CreateMemberAccessExpression();
}