Hello! Using Q1 2012.
I'm trying to set default values for the period bindings and am having some difficulty with VisiblePeriodStart. This guy just doesn't want to get set even though they are in the right order and two-way bound. Suggestions?
View:
ViewModel:
I'm trying to set default values for the period bindings and am having some difficulty with VisiblePeriodStart. This guy just doesn't want to get set even though they are in the right order and two-way bound. Suggestions?
View:
<
telerik:RadTimeBar
Height
=
"150"
Margin
=
"40,20,40,40"
telerik:StyleManager.Theme
=
"Windows7"
PeriodStart
=
"{Binding PeriodStart, Mode=TwoWay}"
PeriodEnd
=
"{Binding PeriodEnd, Mode=TwoWay}"
VisiblePeriodStart
=
"{Binding VisibleStart, Mode=TwoWay}"
VisiblePeriodEnd
=
"{Binding VisibleEnd, Mode=TwoWay}"
SelectionStart
=
"{Binding SelectionStart, Mode=TwoWay}"
SelectionEnd
=
"{Binding SelectionEnd, Mode=TwoWay}"
>
<
telerik:RadTimeBar.Intervals
>
<
telerik:YearInterval
/>
<
telerik:MonthInterval
/>
<
telerik:DayInterval
/>
</
telerik:RadTimeBar.Intervals
>
<
telerik:RadAreaSparkline
ItemsSource
=
"{Binding TimeBarData}"
XValuePath
=
"Date"
YValuePath
=
"Total"
telerik:StyleManager.Theme
=
"Windows7"
AutoRange
=
"False"
/>
</
telerik:RadTimeBar
>
ViewModel:
public
class
ViewModel
{
public
ObservableCollection<DetailTimeBarModel> TimeBarData {
get
;
private
set
; }
public
DateTime PeriodStart {
get
;
set
; }
public
DateTime PeriodEnd {
get
;
set
; }
public
DateTime VisibleStart {
get
;
set
; }
public
DateTime VisibleEnd {
get
;
set
; }
public
DateTime SelectionStart {
get
;
set
; }
public
DateTime SelectionEnd {
get
;
set
; }
public
ViewModel()
{
TimeBarData =
new
ObservableCollection<DetailTimeBarModel>
{
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-20), Total = 5},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-18), Total = 1},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-16), Total = 3},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-14), Total = 7},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-12), Total = 6},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-10), Total = 3},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-8), Total = 12},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-6), Total = 6},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-4), Total = 3},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(-2), Total = 3},
new
DetailTimeBarModel {Date = DateTime.Now.AddDays(0), Total = 2}
};
PeriodStart = TimeBarData.Min(x => x.Date);
PeriodEnd = TimeBarData.Max(x => x.Date);
VisibleStart = PeriodEnd.AddDays(-10);
VisibleEnd = PeriodEnd;
SelectionStart = PeriodEnd.AddDays(-2);
SelectionEnd = PeriodEnd;
}
}
public
class
DetailTimeBarModel
{
public
DateTime Date {
get
;
set
; }
public
int
Total {
get
;
set
; }
}