This is a migrated thread and some comments may be shown as answers.

Simple list<Decimal> binding in xaml c# please

2 Answers 264 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 22 Sep 2015, 07:44 AM

Hi,

I need to do a binding with a simple generic list of Decimal  ( LIST<Decimal> ).

This list<> contain de data i need to bind in my xaml UserControl in C# windows project.

How must i proceed PLEASE ?

 When a set the ItemsSource to this list<> this doesn't work...

 

THANKS for one example please

 

2 Answers, 1 is accepted

Sort by
0
Thomas
Top achievements
Rank 1
answered on 22 Sep 2015, 10:29 AM

Or ObservableCollection<Decimal> instead of the list<Decimal>.

Thank you for one simple example please

 

0
Martin Ivanov
Telerik team
answered on 24 Sep 2015, 09:58 AM
Hi Thomas,

Can you please tell me what chart type you are using? If you want to display your data in a Cartesian or polar chart you should keep in mind that those types of charts visualize two dimensional data and it won't work with a collection of Double values. The chart's series will expect to get two(or more) values values from its ItemsSource's objects. One for the horizontal and another for the vertical axis. If the series is bubble series you will also have to provide a third value for the volume of the data points. You can read more about populating a chart in the Create Data-Bound Chart help article.

On the other side the pie chart's series can display single dimensional data by just setting its ItemsSource to a collection of doubles. Here is an example:
<telerik:RadPieChart>
    <telerik:PieSeries ItemsSource="{Binding}"/>
</telerik:RadPieChart>

this.DataContext = new ObservableCollection<double>() { 2, 8 };

I hope this helps.

Regards,
Martin
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Thomas
Top achievements
Rank 1
Answers by
Thomas
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or