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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using CollectionViewSource to wrap my ItemsSource

Thread ID:





123635 Apr 5,2016 05:26 PM UTC Apr 11,2016 06:35 AM UTC UWP 5
Tags: SfDataGrid
Deanna Delapasse
Asked On April 5, 2016 05:26 PM UTC

My SfDataGrid works great with this binding:  ItemsSource="{x:Bind MainModel.UngroupedMusicList}"

But when I try to define the binding inside a CollectionViewSource
<CollectionViewSource x:Name="UngroupedMusicListSource" Source="{x:Bind MainModel.UngroupedMusicList}"  IsSourceGrouped="False"   />

I've tried various ways and none of them work.
ItemsSource="{Binding Source={StaticResource UngroupedMusicListSource}}"   <== this works for a gridview
ItemsSource="{x:Bind {StaticResource UngroupedMusicListSource}}
ItemsSource="{StaticResource UngroupedMusicListSource}" 

How can I make this work with the CollectionViewSource?

Jayapradha S [Syncfusion]
Replied On April 7, 2016 04:03 AM UTC

Hi Deanna,

Thank you for contacting Syncfusion Support.

We have analyzed your query. We have tried this same and  binding the ItemsSource for SfDataGrid with CollectionViewSource. This retrieves the source as ComObject. So that it is not working in SfDataGrid.

Could you please share the details what is your requirement and why are using CollectionViewSource source as ItemsSource?



Deanna Delapasse
Replied On April 7, 2016 11:32 AM UTC

Hi Jaypradha!

Could you take a look at http://www.codeproject.com/Articles/1081343/Implementing-Windows-GridView-for-UWP-Apps ?   They have both a GroupedMusicList & an UnGroupedMusicList.  I can make the UnGrouped work in SfDataGrid, but NOT the Grouped.

They talk about the importance of setting the IsSourceGrouped="True" flag in the CollectionViewSource, but since I can't use that in SfDataGrid I hope there is another way to point the grid at the correct data.


Jayapradha S [Syncfusion]
Replied On April 8, 2016 01:07 PM UTC

Hi Deanna,

Thank you for your update.

We can understand your requirement. You can achieve it simply by setting the flag from your application like setting IsSourceGrouped in collectionviewsource.

We have prepared a simple sample for your requirement. Here, we have created a property named as IsSourceGrouped and when you setting the flag to true, you can view the grouped items in grid based on prodcutID values.  you can add the group column description based on IsSourceGrouped flag like below

Code Example:

private bool isSourceGrouped = false;

        public bool IsSourceGrouped


            get { return isSourceGrouped; }

            set { isSourceGrouped = value; OnPropertyChanged("IsSourceGrouped"); }


private void Sfgrid_Loaded(object sender, RoutedEventArgs e)


            if (viewModel != null && viewModel.IsSourceGrouped)

                sfgrid.GroupColumnDescriptions.Add(new GroupColumnDescription() { ColumnName = "ProductID" });

Please find the sample from the following location,
Sample Link: http://www.syncfusion.com/downloads/support/forum/123635/ze/SfDataGrid_SourceGrouped267073851


Deanna Delapasse
Replied On April 8, 2016 01:56 PM UTC


That is perfect!   This actually solves my other issue as well, so you can close that one.

Thank you so much.  

Jayapradha S [Syncfusion]
Replied On April 11, 2016 06:35 AM UTC

Hi Deanna,

Thank you for your update. We are glad to know that your requirement has been met.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon