Ye HaoChen
Top achievements
Rank 1
Ye HaoChen
asked on 04 Sep 2013, 03:22 AM
Hi,
I need DateTimeCategoricalAxis.MajorTickInterval's value is dynamic.
For examaple:
I have a list binding with a LineSeries. the list's count are dynamic.
When the number of list is extremely small or large, it will be necessary to set the value of MajorTickIntrval dynamic.
So, the DateTimeCategoricalAxis.MajorTickInterval's value need to changed with List.count.
like:
But the DateTimeCategoricalAxis.MajorTickInterval can not be Binding.(will thrown an exception)
So, have other way can be done this? (Except for the assignment MajorTickInterval)
Thanks
I need DateTimeCategoricalAxis.MajorTickInterval's value is dynamic.
For examaple:
I have a list binding with a LineSeries. the list's count are dynamic.
When the number of list is extremely small or large, it will be necessary to set the value of MajorTickIntrval dynamic.
So, the DateTimeCategoricalAxis.MajorTickInterval's value need to changed with List.count.
like:
//Count: List's count
//MajorStepNum: How many labels are there below the X axis.
MajorTickInterval = Count / MajorStepNum > 1 ? Count / MajorStepNum + 1 : 1;
But the DateTimeCategoricalAxis.MajorTickInterval can not be Binding.(will thrown an exception)
So, have other way can be done this? (Except for the assignment MajorTickInterval)
Thanks
7 Answers, 1 is accepted
0
Hi,
You are absolutely correct, the MajorTickInterval cannot be bound because it is not a dependency property. However you should still be able to achieve the desired effect with code behind.
Regards,
Petar Marchev
Telerik
You are absolutely correct, the MajorTickInterval cannot be bound because it is not a dependency property. However you should still be able to achieve the desired effect with code behind.
Regards,
Petar Marchev
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ye HaoChen
Top achievements
Rank 1
answered on 26 Sep 2013, 06:40 AM
If it is not a dependency property, will break the MVVM architecture.
Do you have any way to solve it?
The Chart in the ListItemTemplate, and MajorTickInterval changes according to the List item data.
In this situation I don't know how to do.
Do you have any way to solve it?
The Chart in the ListItemTemplate, and MajorTickInterval changes according to the List item data.
In this situation I don't know how to do.
0
Hi Ye HaoChen,
You can create a new attached property and use it to set the MajorTickInterval:
Regards,
Petar Marchev
Telerik
You can create a new attached property and use it to set the MajorTickInterval:
public
static
class
ChartUtilities
{
public
static
readonly
DependencyProperty MajorTickIntervalProperty = DependencyProperty.RegisterAttached(
"MajorTickInterval"
typeof
(
int
),
typeof
(ChartUtilities),
new
PropertyMetadata(
null
, OnMajorTickIntervalChanged));
public
static
int
GetMajorTickInterval(DependencyObject obj) ....
public
static
int
Set....
private
static
void
OnDrillDownHelperChanged(DependencyObject target, DependencyPropertyChangedEventArgs args)
{
var axis = target
as
DateTimeCategoricalAxis;
axis.MajorTickInterval = (
int
)args.NewValue;
....
<
telerik:DateTimeCategoricalAxis
utilities:ChartSeriesGenerator.MajorTickinterval
=
"{Binding ...}"
/>
Regards,
Petar Marchev
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ye HaoChen
Top achievements
Rank 1
answered on 26 Sep 2013, 03:00 PM
I would rather appreciate if you could give an example.
Regards
Haochen.Ye
Regards
Haochen.Ye
0
Coder
Top achievements
Rank 1
answered on 20 Feb 2014, 05:14 PM
Could this post please be elaborate on further? Possibly with some example code?
Thanks.
Thanks.
0
Valerio
Top achievements
Rank 1
answered on 22 Oct 2014, 10:48 AM
Same here, could you post an example or extend/complete the code snippet above?
Thanks
Thanks
0
There you go guys.
Regards,
Petar Marchev
Telerik
Regards,
Petar Marchev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.