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

Any ItemSourceControl for WPF RadGridView?

3 Answers 69 Views
GridView
This is a migrated thread and some comments may be shown as answers.
tzuhsun
Top achievements
Rank 1
tzuhsun asked on 16 Mar 2011, 09:26 AM
I trying to bind a "weakly-typed" data list into RadGridView, I considered IList<>, ObservableCollection<> but I think they not suit my scenario because I need to define type of element in those collections.

I found RadDataPager later but I do not need paging feature.

I wonder whether WPF RadGridView can bind to something like "DataTable" like in WinForm, but I asking it for WPF in case there is any ready component in Telerik WPF.

Anyway this is my scenario, single RadGridView is use and ready to receive data collection which may consist of different data type.

Please advise, thanks

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Mar 2011, 09:29 AM
Hello,

 There will be no problem to bind the grid to DataTable. 

Best wishes,
Vlad
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
tzuhsun
Top achievements
Rank 1
answered on 16 Mar 2011, 09:43 AM
Hi, in my case a preview pane going to bind to that RadGridView when a row is selected, if use DataTable, would it affect the binding between GridView and preview pane?
0
tzuhsun
Top achievements
Rank 1
answered on 17 Mar 2011, 03:20 AM
Read this in RadGridView online Documentation:

Unlike a standard items control, the RadGridView's ItemsSource property is declared to be of type System.Object.


Therefore use System.object will do. :)

sample code as follows:
private ObservableCollection<Employee> _employeeCollection;
private object _gridResult;
  
private void Search()
{
    var employeeList = DAL.GetEmployeeList();
  
    _employeeCollection = new ObservableCollection<Employee>();
    _employeeCollection.AddRange(employeeList);
  
    _gridResult = _employeeCollection;
     
    // Next is expose _gridResult to a property, and bind that into RadGridView in xaml.
}

Thanks for the time spend on this.
Tags
GridView
Asked by
tzuhsun
Top achievements
Rank 1
Answers by
Vlad
Telerik team
tzuhsun
Top achievements
Rank 1
Share this question
or