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

Using RadGridView inside a custom control

1 Answer 75 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Barry
Top achievements
Rank 1
Barry asked on 30 Nov 2011, 02:34 PM
I'm trying to create a control that ties together a RadGridView with a RadTimeBar and AreaSparkline into a single control that can accept an itemssource that will fill the gridview and set the time bar and fill the sparkline. The issue that I'm having is that I can't figure out how to get the itemssource to be type independent or how to have the itemssource be filled when the control is loaded.

When you set the itemssource on a RadGridView the gridview doesn't care what type the object is in the collection, it just takes that collection and fills the gridview with it. I would like that functionality for my control. I could just have my control inherit the RadGridView and use its itemssource, but I need the gridview to be loaded with items that are dependent on the selected dates in the time bar. I can inherit from RadAreaSparkline and use its itemssource, but for some reason when I do that the itemssource doesn't fill when the control is loaded as it does with the RadGridView. The data only appears there when I change the data after it has been initialized. I don't understand this.

Attached is a picture of what it looks like... this example is not a single control, but the separate controls, all set separately on the page. I would like to put them all together into a single control that you only have to set an itemssource for. The control would then set the periodstart and periodend, selectionstart and selectionend on the time bar to defaults based on a property in the itemssource and fill areasparkline and the gridview with the items.

Is there any way to set a type independent itemssource dependency property that I can use for the control? Why does the RadGridView fill when I inherit from it and fill the itemsource and the RadAreaSparkline does not?

Any help would be greatly appreciated.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 05 Dec 2011, 10:59 AM
Hi Barry,

Our local tests do not show any issues related to RadAreaSparkline and inheriting from it seems to work correctly on our end. There is a difference, however, between RadGridView and RadSparkLine. While RadGridView just displays the data, RadAreaSparkline needs to be configured to interpret that data in order to transfrom it to a graphical view. Besides providing ItemsSource, you need to set the XValuePath and YValuePath properties as described in this help topic.

So, you can still use type independent ItemsSource (it just has to be IEnumerable) but you need to perfrom the extra step of teaching the control how to read that data using the properties mentioned above.


Kind regards,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Barry
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or