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

Setting SelectedItems property in SfDataGrid

Hi,

I'm using a SfDataGrid control with SelectionMode="Multiple".  I am trying to bind the SelectedItems property to an ObservableCollection<object> in my view model class but VisualStudio gives the following error:

"The property "Selected Items" does not have an accessible setter".

However, the solution does build and run successfully even though the error is still there.  Can you confirm whether or not this is a bug in the SfDataGrid control?

For info, the grid is declared in the view as follows:

<grid:SfDataGrid AllowSorting="True" ItemsSource="{Binding Documents}" 
                         ColumnSizer="Star"
                         NavigationMode="Row" SelectionMode="Multiple"
                         SelectedItems="{Binding SelectedDocuments}"
And "SelectedItems" binds to the following property on the view model:

public ObservableCollection<object> SelectedDocuments { getset; }

I also note that the SelectedItems property does not appear in Intellisense when adding properties to the SfDataGrid control XAML.

Grateful for any help/advice you can give.

Regards,
Andrew

4 Replies

AR Andrew Ridout January 28, 2014 01:58 PM UTC

Further to my above post, I have upgraded to Syncfusion for WinRT v11.4.0.26 and I am now getting the following run time exception:

The property 'SelectedItems' was not found in type SfDataGrid'."

Please can you advise how I can access the SelectedItems property on the SfDataGrid control?

Regards,
Andrew


JG Jai Ganesh S Syncfusion Team January 30, 2014 09:16 AM UTC

Hi Andrew,

 

Thank you for using Syncfusion products.

 

We have analyzed your queries and please find the responses for your queries below,

 

Query 1:

 

The “SelectedItems” property in SfDataGrid is a read only property and it is used to get the SelectedItems  and we cannot set the values in it.

 

Query 2:

 

The “SelectedItems” property does not appear in the intellisense because it is a read only property. The read only properties will not appear in intellisense.

 

Query 3:

 

You can get the “SelectedItems” by using  the datagrid.SelectedItems property. We have prepared the sample based on this and please find the sample under the following location.

 

Sample: WinrtGridSample.zip

 

Please let us know if you need further assistance.

 

Thank you,

Jai Ganesh S



AR Andrew Ridout January 30, 2014 03:22 PM UTC

Thanks, this is exactly what I needed.  I appreciate your help.

Regards,
Andrew


JG Jai Ganesh S Syncfusion Team January 30, 2014 06:56 PM UTC

Hi Andrew,

 

Thank you for your update.

 

Please let us know if you have any queries.

 

Thank you,

Jai Ganesh S


Loader.
Live Chat Icon For mobile
Up arrow icon