We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Binding collectionviewsource to datagrid


How to bind CollectionViewSource to Datagrid? Because I've tried some things but no data is displayed.


            <CollectionViewSource x:Name="SampleDataViewSource" />         

 <Grid:SfDataGrid Name="SampleGrid" Margin="0" 
                             ItemsSource="{Binding SampleDataViewSource}"                           
                    <Grid:GridTextColumn HeaderText="ID" MappingName="id" />
                    <Grid:GridTextColumn HeaderText="Customer" MappingName="name" />
                    <Grid:GridTextColumn HeaderText="Country" MappingName="country" />               

However if I bound this CollectionViewSource to GridView, data is displayed.

Thanks un advance


1 Reply

MG Mohanraj Gunasekaran Syncfusion Team February 13, 2015 11:43 AM UTC

Hi Anna,

Thanks for contacting Syncfusion support,

We have analyzed your query and we don’t have support to bind CollectionViewSource. Instead of that, you can bind GridQueryableCollectionViewWrapper of SfDataGrid which is derived from ICollectionView. Please refer the code snippet and sample in below location.

Code snippet:

this.datagrid.ItemsSource = new GridQueryableCollectionViewWrapper(new ViewModel().Source1, this.datagrid);

Sample location: http://www.syncfusion.com/uploads/user/directTrac/118223/VeticalAlignment-1142284013.zip

If the above solution doesn’t meet your requirement, Please let us know why do you need to bind CollectionViewSource. That will help us to provide better solution.

Please let us know if you have any further assistance,



Live Chat Icon For mobile
Up arrow icon